Skip to content

Tag: filtering

stream filter return null findFirst getting exception

The following will throw an exception, if the personList is empty or the filtered result is empty: I get the following error: How to solve the error? Actually, I just expect it should return one object or null. Answer get will throw an exception if called on an empty Optional. Instead, you could use orElse to return a null:

Is there a way to make empty packages visible in Eclipse?

Is there a way in Eclipse, to see empty parent packages? I have an issue freely viewing/accessing package new.galaxywar.client.resources.images.game that only contains 2 sub-packages: I tried creating that package again, because I thought that i might not have it in my eclipse project, but it won’t let me: How do I prevent “views from filtering empty parent packages”? Answer In