Source:
<code>public Page<UserDevfile> getDevfiles( int maxItems, int skipCount, List<Pair<String, String>> filter, List<Pair<String, String>> order) throws ServerException { checkArgument(maxItems > 0, "The number of items has to be positive."); checkArgument( skipCount >= 0, "The number of items to skip can't be negative or greater than " + Integer.MAX_VALUE); if (filter != null && !filter.isEmpty()) { List<Pair<String, String>> invalidFilter = filter .stream() .filter(p -> !p.first.equalsIgnoreCase("devfile.metadata.name")) .collect(toList()); if (!invalidFilter.isEmpty()) { throw new IllegalArgumentException( "Filtering allowed only on `devfile.metadata.name`. But got: " + invalidFilter); } } List<Pair<String, String>> effectiveOrder = DEFAULT_ORDER; if (order != null && !order.isEmpty()) { List<Pair<String, String>> invalidSortOrder = order .stream() <START> .filter(p -> !p.second.equalsIgnoreCase("asc")) <END> .filter(p -> !p.second.equalsIgnoreCase("desc")) .collect(Collectors.toList()); if (!invalidSortOrder.isEmpty()) { throw new IllegalArgumentException( "Invalid sort order direction. Possible values 'asc' or 'desc'. But got: " + invalidSortOrder); } effectiveOrder = order; } try { final long count = newBuilder(managerProvider.get()).withFilter(filter).buildCountQuery().getSingleResult(); if (count == 0) { return new Page<>(emptyList(), skipCount, maxItems, count); } List<UserDevfileImpl> result = newBuilder(managerProvider.get()) .withFilter(filter) .withOrder(effectiveOrder) .withMaxItems(maxItems) .withSkipCount(skipCount) .buildSelectItemsQuery() .getResultList() .stream() .map(UserDevfileImpl::new) .collect(toList()); return new Page<>(result, skipCount, maxItems, count); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }</code><technical_language>in single statement && ? anyMatch()</technical_language>

Target:
public Page<UserDevfile> getDevfiles( int maxItems, int skipCount, List<Pair<String, String>> filter, List<Pair<String, String>> order) throws ServerException { checkArgument(maxItems > 0, "The number of items has to be positive."); checkArgument( skipCount >= 0, "The number of items to skip can't be negative or greater than " + Integer.MAX_VALUE); if (filter != null && !filter.isEmpty()) { List<Pair<String, String>> invalidFilter = filter .stream() .filter(p -> !p.first.equalsIgnoreCase("devfile.metadata.name")) .collect(toList()); if (!invalidFilter.isEmpty()) { throw new IllegalArgumentException( "Filtering allowed only on `devfile.metadata.name`. But got: " + invalidFilter); } } List<Pair<String, String>> effectiveOrder = DEFAULT_ORDER; if (order != null && !order.isEmpty()) { List<Pair<String, String>> invalidSortOrder = order .stream() .filter(p -> !p.second.equalsIgnoreCase("asc") && !p.second.equalsIgnoreCase("desc")) .collect(Collectors.toList()); if (!invalidSortOrder.isEmpty()) { throw new IllegalArgumentException( "Invalid sort order direction. Possible values 'asc' or 'desc'. But got: " + invalidSortOrder); } effectiveOrder = order; } try { final long count = newBuilder(managerProvider.get()).withFilter(filter).buildCountQuery().getSingleResult(); if (count == 0) { return new Page<>(emptyList(), skipCount, maxItems, count); } List<UserDevfileImpl> result = newBuilder(managerProvider.get()) .withFilter(filter) .withOrder(effectiveOrder) .withMaxItems(maxItems) .withSkipCount(skipCount) .buildSelectItemsQuery() .getResultList() .stream() .map(UserDevfileImpl::new) .collect(toList()); return new Page<>(result, skipCount, maxItems, count); } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }