package love.distributedrebirth.bassboonyd; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.function.Consumer; import java.util.stream.Stream; /** * Inject EnumSet methods. * * @author willemtsade ©Δ∞ 仙上主天 */ public interface BaßBȍőnEnumSetʸᴰ extends BaßBȍőnEnumʸᴰ { @SuppressWarnings("unchecked") default T[] staticInstances() { try { Object result = getClass().getMethod("values").invoke(null); return (T[]) result; } catch (Exception e) { throw new RuntimeException(e); } } default List staticInstancesList() { return Arrays.asList(staticInstances()); } default Iterator staticInstancesIterator() { return staticInstancesList().iterator(); } default Stream staticInstancesStream() { return staticInstancesList().stream(); } default T volgende() { T[] values = staticInstances(); int resultIndex = 0; for (int i=0;i consumer) { for (T value:staticInstances()) { consumer.accept(value); } } }