Codota Logo
PredicatedSortedSet
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
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 tailSet(Object fromElement) {
  SortedSet sub = getSortedSet().tailSet(fromElement);
  return new PredicatedSortedSet(sub, predicate);
}
origin: commons-collections/commons-collections

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

origin: wildfly/wildfly

public Comparator comparator() {
  return getSortedSet().comparator();
}
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 headSet(Object toElement) {
  SortedSet sub = getSortedSet().headSet(toElement);
  return new PredicatedSortedSet(sub, predicate);
}
origin: commons-collections/commons-collections

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

origin: wildfly/wildfly

public Object last() {
  return getSortedSet().last();
}
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

  • Making http requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • BoxLayout (javax.swing)
  • JTable (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now