overlaymanager: Add anyMatch method

This will help plugins make informed decisions when, say, displaying
different text when toggling an overlay on and off.
This commit is contained in:
Jordan Atwood
2019-07-12 22:27:55 -07:00
committed by Adam
parent f2cfea57cc
commit c6149f0db0

View File

@@ -217,6 +217,17 @@ public class OverlayManager
return removeIf;
}
/**
* Returns whether an overlay exists which matches the given predicate.
*
* @param filter Filter predicate function
* @return {@code true} if any overlays match the given filter, {@code false} otherwise
*/
public synchronized boolean anyMatch(Predicate<Overlay> filter)
{
return overlays.stream().anyMatch(filter);
}
/**
* Clear all overlays
*/