Java 8 SortedSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SortedSet class.

This code example shows how to use the following methods: comparator
	public boolean addAll(Collection<? extends E> c) {
		// Use linear-time version if applicable 
		if (m.size() == 0 && c.size() > 0 && c instanceof SortedSet && m instanceof OMVRBTree) {
			SortedSet<? extends E> set = (SortedSet<? extends E>) c;
			OMVRBTree<E, Object> map = (OMVRBTree<E, Object>) m;
			Comparator<? super E> cc = (Comparator<? super E>) set.comparator();
			Comparator<? super E> mc = map.comparator();
			if (cc == mc || (cc != null && cc.equals(mc))) {
				map.addAllForOTreeSet(set, PRESENT);
				return true; 
			} 
		} 
		return super.addAll(c);
	} 
 
	/** 
	 * @throws ClassCastException 
	 *           {@inheritDoc} 
	 * @throws NullPointerException 
	 *           if {@code fromElement} or {@code toElement} is null and this set uses natural ordering, or its comparator does not 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: add
    if (child.parent != null) {
      throw new IllegalArgumentException(
          "The child is already under another node:" + child.parent);
    } 
    checkChildren(); 
    boolean retval = children.add(child);
    if (retval) child.parent = this;
    return retval;
  } 
 
  /** 
   * Does this node have any children? 
   * @return Boolean indicate whether this node has any children. 
   */ 
  public synchronized boolean hasChildren() { 
    return children != null && !children.isEmpty();
  } 
 
  /** 
   * Get the children of this node. 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isEmpty, first, tailSet
    if(confException != null) {
      LOG.error(confException.getMessage(), confException);
      return -1; 
    } 
 
    if(tabletInfoSet.isEmpty()) {
      LOG.error("tablet partition size is zero");
      return -1; 
    } 
    int partitionNumber = 0;
    Row.Key rowKey = new Row.Key(key.toString());
     
    SortedSet<RowKeyItem> tailSet = tabletInfoSet.tailSet(new RowKeyItem(rowKey, 0));
    if(!tailSet.isEmpty()) {
      partitionNumber = tailSet.first().index;
    } else { 
      partitionNumber = tabletInfoSet.last().index;
    } 
     
    if(partitionNumber >= numPartitions) {
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: comparator
		} 
		else if (collection instanceof List) {
			return new ArrayList<E>(initialCapacity);
		} 
		else if (collection instanceof SortedSet) {
			return new TreeSet<E>(((SortedSet<E>) collection).comparator());
		} 
		else { 
			return new LinkedHashSet<E>(initialCapacity);
		} 
	} 
 
	/** 
	 * Create the most appropriate collection for the given collection type. 
	 * <p>Creates an ArrayList, TreeSet or linked Set for a List, SortedSet 
	 * or Set, respectively. 
	 * @param collectionType the desired type of the target Collection 
	 * @param initialCapacity the initial capacity 
	 * @return the new Collection instance 
	 * @see java.util.ArrayList 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isEmpty, first
     *        whether the value being retrieved should be percent decoded 
     * @return the first value found for this parameter 
     */ 
    public String getFirst(Object key, boolean percentDecode) {
        SortedSet<String> values = wrappedMap.get(key);
        if (values == null || values.isEmpty()) {
            return null; 
        } 
        String value = values.first();
        return percentDecode ? OAuth.percentDecode(value) : value;
    } 
 
    /** 
     * Concatenates all values for the given key to a list of key/value pairs 
     * suitable for use in a URL query string. 
     *  
     * @param key 
     *        the parameter name 
     * @return the query string 
     */ 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 SortedSet Methods: