vikasprabhakar opened a new pull request #1237: [NETBEANS-2349] Convert switch 
typecast case to switch expression
URL: https://github.com/apache/netbeans/pull/1237
 
 
   Convert to switch expression for following scenario (return case):
   
   Actual Code:
   
   void test(Object o1, Object o2, Object o3, int n) {
   String result;
   switch(n) { 
   case 1: 
   result = (String) o1;
   break; 
   case 2: 
   result = (String) o2;
   break; 
   default: 
   result = (String) o3;
   break; 
   }
   System.out.println(result);
   } 
   
   After Fix with hints Hint : 'Convert to switch expression'
   
   void test(Object o1, Object o2, Object o3, int n) {
   String result;
   result = (String)( switch (n){ 
   case 1 -> o1; 
   case 2 -> o2; 
   default -> o3; }
   );
   System.out.println(result);
   }

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to