Helps to filter only GHEventsSubscribers that can return TRUE on given item

@param item to check every GHEventsSubscriber for being applicable

@return predicate to use in iterable filtering
@see #isApplicable
@since 1.25.0
167331
public static Predicate<GHEventsSubscriber> isApplicableFor(final Item item) {
        return new NullSafePredicate<GHEventsSubscriber>() {
            @Override
            protected boolean applyNullSafe(@Nonnull GHEventsSubscriber subscriber) {
                return subscriber.safeIsApplicable(item);
            }
        };
    }
1246433
public static final IEventFilter not(final IEventFilter filter)
    {
        return new AbstractEventFilter()
        {
            @Override
            public final boolean test(final GwtEvent<?> event)
            {
                return (false == filter.test(event));
            }
        };
    }
51422
public static Iterator<Token[]> tokenIterator(ItemRule itemRule) {
        Iterator<Token[]> it = null;
        if (itemRule.isListableType()) {
            List<Token[]> list = itemRule.getTokensList();
            if (list != null) {
                it = list.iterator();
            }
        } else if (itemRule.isMappableType()) {
            Map<String, Token[]> map = itemRule.getTokensMap();
            if (map != null) {
                it = map.values().iterator();
            }
        } else {
            return new Iterator<Token[]>() {
                private int count = 0;
                @Override
                public boolean hasNext() {
                    return (count++ < 1);
                }
                @Override
                public Token[] next() {
                    return itemRule.getTokens();
                }
                @Override
                public void remove() {
                    throw new UnsupportedOperationException("Cannot remove an element of an array");
                }
            };
        }
        return it;
    }
944264
public static <T> Iterator<T> filter(Iterator<T> it, Predicate<T> filter) {
        return new Iterator<T>() {

            private T cached = null;

            @Override
            public boolean hasNext() {
                if (this.cached != null) {
                    return true;
                }

                boolean test = false;
                while (it.hasNext() && !test) {
                    this.cached = it.next();
                    test = filter.test(this.cached);
                }
                return test;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                final T result = this.cached;
                this.cached = null;
                return result;
            }

            @Override
            public void remove() {
                it.remove();
            }
        };
    }
626925
protected void _setMembership(Membership membership, AbstractItem item)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "_setMembership", new Object[] { membership, item });

        item._setMembership(membership);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "_setMembership");
    }
638675
public List<CmsListItem> filter(List<CmsListItem> items, String filter) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(filter)) {
            return items;
        }
        String filterCriteria = filter;
        if (m_caseInSensitive) {
            filterCriteria = filter.toLowerCase();
        }

        List<CmsListItem> res = new ArrayList<CmsListItem>();
        Iterator<CmsListItem> itItems = items.iterator();
        while (itItems.hasNext()) {
            CmsListItem item = itItems.next();
            if (res.contains(item)) {
                continue;
            }
            Iterator<CmsListColumnDefinition> itCols = m_columns.iterator();
            while (itCols.hasNext()) {
                CmsListColumnDefinition col = itCols.next();
                if (item.get(col.getId()) == null) {
                    continue;
                }
                String columnValue = item.get(col.getId()).toString();
                if (m_caseInSensitive) {
                    columnValue = columnValue.toLowerCase();
                }
                if (columnValue.indexOf(filterCriteria) > -1) {
                    res.add(item);
                    break;
                }
            }
        }
        return res;
    }
401220
public boolean mightContain(T item) {
		BucketAndTag pos = hasher.generate(item);
		long i1 = pos.index;
		long i2 = hasher.altIndex(pos.index, pos.tag);
		bucketLocker.lockBucketsRead(i1, i2);
		try {
			if (table.findTag(i1, i2, pos.tag)) {
				return true;
			}
		} finally {
			bucketLocker.unlockBucketsRead(i1, i2);
		}
		return checkIsVictim(pos);
	}
1314487
@Override
    public <I> MatchResult<I> matchResult(I item) {
        StringDescription mismatch = new StringDescription();
        if (matches(item, mismatch)) {
            return new MatchResultSuccess<>(item, this);
        } else {
            return new MatchResultMismatch<>(item, this, mismatch.toString());
        }
    }
1104687
private void filter(Predicate<TreeItem<S>> predicate) {
        if (task != null) {
            task.cancel(false);
        }
        task = threadPool.schedule(filterRunnable, 200, TimeUnit.MILLISECONDS);
    }
753580
public boolean removeItem (T item)
    {
        int index = _items.indexOf(item);
        if (index == -1) {
            return false;
        }
        _items.remove(index);
        removeItem(index);
        return true;
    }
280309
public static <T> Matcher<Iterable<T>> hasItems(Iterable<T> items) {
        List<Matcher<? super Iterable<T>>> all = new LinkedList<Matcher<? super Iterable<T>>>();
        for (T element : items) {
            all.add(hasItem(element));
        }

        return allOf(all);
    }
1209287
protected I_CmsFacetQueryItem parseFacetQueryItem(JSONObject item) {

        String query;
        try {
            query = item.getString(JSON_KEY_QUERY_FACET_QUERY_QUERY);
        } catch (JSONException e) {
            // TODO: Log
            return null;
        }
        String label = parseOptionalStringValue(item, JSON_KEY_QUERY_FACET_QUERY_LABEL);
        return new CmsFacetQueryItem(query, label);
    }
286931
private boolean contains(List<String> list, String item) {
        return (null == list) ? false : list.contains(item);
    }
590217
public boolean filterMatches(AbstractItem item)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "filterMatches", item);

    /* Cast the incoming item to a PersistentStoreReferenceStream object. if it is not, an
     * exception will be thrown and the match will fail */

    SIMPReferenceStream rstream;

    if (item instanceof SIMPReferenceStream) {

      rstream = (SIMPReferenceStream) item;
    
      // Check for matching consumer dispatchers
      if (rstream == consumerDispatcher.getReferenceStream())
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          SibTr.exit(tc, "filterMatches", Boolean.TRUE);        
        return true;
      }      
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "filterMatches", Boolean.FALSE);
    return false;

  }
401219
@Override
	public boolean filter(Object entity) {
		for (Filter filter : filters) {
			if (filter.filter(entity)) {
				return true;
			}
		}

		return false;
	}
504416
public static <E> List<E> filter(final Iterable<E> iterable, final Predicate<E> pred) {
        final List<E> filtered = newArrayList();
        for (E element : iterable) {
            if (pred.test(element)) {
                filtered.add(element);
            }
        }
        return filtered;
    }
1253646
public AbstractItem findFirstMatchingItem(Filter filter) throws MessageStoreException 
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findFirstMatching", filter);

        PrioritizedList items = _items();
        AbstractItem item = items.findFirstMatching(filter);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "findFirstMatching", item);
        return item;
    }