If I have three Classes (Foo, Bar and FooBar), how can I check for instance inside a Stream in Java 8?
Is there anything like:
Foo foo = new Foo();
if (Stream.of<Class>(Foo.class, Bar.class, FooBar.class).anyMatch(c -> foo instanceof c)) {
System.out.println("yes");
}
I want to avoid things like:
if (foo instnaceof Foo || foo instanceof Bar || foo instanceof FooBar) {...}