Tabnine Logo
PredicatedSortedSet
Code IndexAdd Tabnine to your IDE (free)

How to use
PredicatedSortedSet
in
org.apache.commons.collections.set

Best Java code snippets using org.apache.commons.collections.set.PredicatedSortedSet (Showing top 20 results out of 315)

origin: commons-collections/commons-collections

/**
 * Returns a predicated (validating) sorted set backed by the given sorted set.  
 * <p>
 * Only objects that pass the test in the given predicate can be added to the set.
 * Trying to add an invalid object results in an IllegalArgumentException.
 * It is important not to use the original set after invoking this method,
 * as it is a backdoor for adding invalid objects.
 *
 * @param set  the sorted set to predicate, must not be null
 * @param predicate  the predicate for the sorted set, must not be null
 * @return a predicated sorted set backed by the given sorted set
 * @throws IllegalArgumentException  if the Set or Predicate is null
 */
public static SortedSet predicatedSortedSet(SortedSet set, Predicate predicate) {
  return PredicatedSortedSet.decorate(set, predicate);
}
origin: commons-collections/commons-collections

public SortedSet headSet(Object toElement) {
  SortedSet sub = getSortedSet().headSet(toElement);
  return new PredicatedSortedSet(sub, predicate);
}
origin: commons-collections/commons-collections

/**
 * Gets the sorted set being decorated.
 * 
 * @return the decorated sorted set
 */
private SortedSet getSortedSet() {
  return (SortedSet) getCollection();
}
origin: commons-collections/commons-collections

public Object first() {
  return getSortedSet().first();
}
origin: commons-collections/commons-collections

/**
 * Factory method to create a predicated (validating) sorted set.
 * <p>
 * If there are any elements already in the set being decorated, they
 * are validated.
 * 
 * @param set  the set to decorate, must not be null
 * @param predicate  the predicate to use for validation, must not be null
 * @throws IllegalArgumentException if set or predicate is null
 * @throws IllegalArgumentException if the set contains invalid elements
 */
public static SortedSet decorate(SortedSet set, Predicate predicate) {
  return new PredicatedSortedSet(set, predicate);
}
origin: commons-collections/commons-collections

public Object last() {
  return getSortedSet().last();
}
origin: wildfly/wildfly

/**
 * Factory method to create a predicated (validating) sorted set.
 * <p>
 * If there are any elements already in the set being decorated, they
 * are validated.
 * 
 * @param set  the set to decorate, must not be null
 * @param predicate  the predicate to use for validation, must not be null
 * @throws IllegalArgumentException if set or predicate is null
 * @throws IllegalArgumentException if the set contains invalid elements
 */
public static SortedSet decorate(SortedSet set, Predicate predicate) {
  return new PredicatedSortedSet(set, predicate);
}
origin: commons-collections/commons-collections

public SortedSet tailSet(Object fromElement) {
  SortedSet sub = getSortedSet().tailSet(fromElement);
  return new PredicatedSortedSet(sub, predicate);
}
origin: wildfly/wildfly

/**
 * Returns a predicated (validating) sorted set backed by the given sorted set.  
 * <p>
 * Only objects that pass the test in the given predicate can be added to the set.
 * Trying to add an invalid object results in an IllegalArgumentException.
 * It is important not to use the original set after invoking this method,
 * as it is a backdoor for adding invalid objects.
 *
 * @param set  the sorted set to predicate, must not be null
 * @param predicate  the predicate for the sorted set, must not be null
 * @return a predicated sorted set backed by the given sorted set
 * @throws IllegalArgumentException  if the Set or Predicate is null
 */
public static SortedSet predicatedSortedSet(SortedSet set, Predicate predicate) {
  return PredicatedSortedSet.decorate(set, predicate);
}
origin: commons-collections/commons-collections

public Comparator comparator() {
  return getSortedSet().comparator();
}
origin: commons-collections/commons-collections

/**
 * Factory method to create a typed sorted set.
 * <p>
 * If there are any elements already in the set being decorated, they
 * are validated.
 * 
 * @param set  the set to decorate, must not be null
 * @param type  the type to allow into the collection, must not be null
 * @throws IllegalArgumentException if set or type is null
 * @throws IllegalArgumentException if the set contains invalid elements
 */
public static SortedSet decorate(SortedSet set, Class type) {
  return new PredicatedSortedSet(set, InstanceofPredicate.getInstance(type));
}

origin: wildfly/wildfly

/**
 * Gets the sorted set being decorated.
 * 
 * @return the decorated sorted set
 */
private SortedSet getSortedSet() {
  return (SortedSet) getCollection();
}
origin: wildfly/wildfly

public SortedSet headSet(Object toElement) {
  SortedSet sub = getSortedSet().headSet(toElement);
  return new PredicatedSortedSet(sub, predicate);
}
origin: commons-collections/commons-collections

protected SortedSet makeTestSet() {
  return PredicatedSortedSet.decorate(new TreeSet(), testPredicate);
}

origin: wildfly/wildfly

public Object last() {
  return getSortedSet().last();
}
origin: wildfly/wildfly

/**
 * Factory method to create a typed sorted set.
 * <p>
 * If there are any elements already in the set being decorated, they
 * are validated.
 * 
 * @param set  the set to decorate, must not be null
 * @param type  the type to allow into the collection, must not be null
 * @throws IllegalArgumentException if set or type is null
 * @throws IllegalArgumentException if the set contains invalid elements
 */
public static SortedSet decorate(SortedSet set, Class type) {
  return new PredicatedSortedSet(set, InstanceofPredicate.getInstance(type));
}

origin: org.apache.directory.api/api-ldap-client-all

/**
 * Gets the sorted set being decorated.
 * 
 * @return the decorated sorted set
 */
private SortedSet getSortedSet() {
  return (SortedSet) getCollection();
}
origin: wildfly/wildfly

public SortedSet tailSet(Object fromElement) {
  SortedSet sub = getSortedSet().tailSet(fromElement);
  return new PredicatedSortedSet(sub, predicate);
}
origin: commons-collections/commons-collections

public Set makeEmptySet() {
  return PredicatedSortedSet.decorate(new TreeSet(), truePredicate);
}

origin: wildfly/wildfly

public Comparator comparator() {
  return getSortedSet().comparator();
}
org.apache.commons.collections.setPredicatedSortedSet

Javadoc

Decorates another SortedSet to validate that all additions match a specified predicate.

This set exists to provide validation for the decorated set. It is normally created to decorate an empty set. If an object cannot be added to the set, an IllegalArgumentException is thrown.

One usage would be to ensure that no null entries are added to the set.

SortedSet set = PredicatedSortedSet.decorate(new TreeSet(), NotNullPredicate.INSTANCE);

This class is Serializable from Commons Collections 3.1.

Most used methods

  • decorate
    Factory method to create a predicated (validating) sorted set. If there are any elements already in
  • <init>
    Constructor that wraps (not copies). If there are any elements already in the set being decorated, t
  • getCollection
  • getSortedSet
    Gets the sorted set being decorated.
  • getSet

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now