Fixed SpecificationsBuilder to support immutable Collections and added a test for it

Signed-off-by: Dominik Herbst <dominik.herbst@bosch-si.com>
This commit is contained in:
Dominik Herbst
2016-10-12 14:40:03 +02:00
parent 0e6f2e01cf
commit 771da69fca
2 changed files with 108 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ public final class SpecificationsBuilder {
* where clause.
*
* @param specList
* all specification wich will combine
* all specification which will combine
* @return <null> if the given specification list is empty
*/
public static <T> Specifications<T> combineWithAnd(final List<Specification<T>> specList) {
@@ -36,8 +36,7 @@ public final class SpecificationsBuilder {
return null;
}
Specifications<T> specs = Specifications.where(specList.get(0));
specList.remove(0);
for (final Specification<T> specification : specList) {
for (final Specification<T> specification : specList.subList(1, specList.size())) {
specs = specs.and(specification);
}
return specs;