Use "instanceof pattern matching" in sample in reference docs

Closes gh-28332
This commit is contained in:
Johannes Wengert
2022-04-13 12:16:10 +02:00
committed by GitHub
parent 1574fed90b
commit 08bc9edcbc

View File

@@ -1964,9 +1964,9 @@ The following example shows a simple implementation of an MDP:
public class ExampleListener implements MessageListener {
public void onMessage(Message message) {
if (message instanceof TextMessage) {
if (message instanceof TextMessage textMessage) {
try {
System.out.println(((TextMessage) message).getText());
System.out.println(textMessage.getText());
}
catch (JMSException ex) {
throw new RuntimeException(ex);