Answers for "Fast Lookup of Java"

1

Fast Lookup of Java

Set<String> animals = new HashSet<String>(
                          Arrays.asList("cat", "dog", "squirrel", "raccoon"));
if (animals.contains("dog")) {
    System.out.println("Yep, dog's here!"); // prints
}
if (!animals.contains("aardvark")) {
    System.out.println("Ah, aardvark's missing!"); // prints
}
Posted by: Guest on September-19-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language