I'm spoiled by Python - it's so easy to do some things like check the presence of an item in a list:
So what's the equivalent of this in Java?
Thanks to this stackoverflow discussion for the answer.
mylist = ['a', 'b', 'c'] if 'a' in mylist: print "It's there!"
So what's the equivalent of this in Java?
if( Arrays.asList("a","b","c").contains("a") ) system.out.println( "It's there!" );
Thanks to this stackoverflow discussion for the answer.
No comments:
Post a Comment