In the first fragment, you create Streamfrom Objects. Element 2is Integer, so comparing it to String"2" returns false.
int 2, Object 2.
true, String ( equals ==, String).
System.out.println(Stream.of("hi", "there", "2").anyMatch(i->i.equals("2")));
equals ==, equals Object:
System.out.println(Stream.of("hi", "there",2).anyMatch(i->i.equals(2)));