You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/05/08 04:36:37 UTC

[GitHub] [netbeans] vikasprabhakar opened a new pull request #1237: [NETBEANS-2349] Convert switch typecast case to switch expression

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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