com.github.thorbenkuck.keller.repository.SupplyingImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of keller-repo Show documentation
Show all versions of keller-repo Show documentation
Keller is a universal base-package
The newest version!
package com.github.thorbenkuck.keller.repository;
import java.util.Collection;
import java.util.Random;
public class SupplyingImpl implements Supplying {
private final ActionStack actionStack;
public SupplyingImpl(final ActionStack actionStack) {
this.actionStack = actionStack;
}
@Override
public T getFirst() {
return actionStack.getPrimaryMatchingElement();
}
@Override
public T getAny() {
return actionStack.getMatchingObjects().get(new Random(12300123).nextInt(actionStack.getMatchingObjects().size()));
}
@Override
public Collection getAll() {
return actionStack.getMatchingObjects();
}
@Override
public NotPresentHandler ifNotPresent() {
return new NotPresentHandlerImpl<>(actionStack);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy