Guava ImmutableSortedSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava ImmutableSortedSet class.

This code example shows how to use the following methods:isEmpty
This code example shows how to use the following methods:iterator, size
    public void testImmutableSortedSet( ObjectMapperTester<ImmutableSortedSet<Integer>> mapper ) {
        String json = mapper.write( ImmutableSortedSet.of( 5, 1, 2 ) );
        assertEquals( "[1,2,5]", json );
 
        ImmutableSortedSet<Integer> set = mapper.read( "[5,1,2]" );
        assertEquals( 3, set.size() );
        Iterator<Integer> it = set.iterator();
        assertEquals( Integer.valueOf( 1 ), it.next() );
        assertEquals( Integer.valueOf( 2 ), it.next() );
        assertEquals( Integer.valueOf( 5 ), it.next() );
    } 
 
    public void testImmutableMap( ObjectMapperTester<ImmutableMap<Integer, Boolean>> mapper ) {
        String json = mapper.write( ImmutableMap.of( 12, true, 4, false ) );
        assertEquals( "{\"12\":true,\"4\":false}", json );
 
        ImmutableMap<Integer, Boolean> map = mapper.read( json );
        assertEquals( 2, map.size() );
        assertEquals( Boolean.TRUE, map.get( Integer.valueOf( 12 ) ) );
        assertEquals( Boolean.FALSE, map.get( Integer.valueOf( 4 ) ) );
5
CodeRank
This code example shows how to use the following methods:iterator
   *  
   * @return the tenors in the terms, not null 
   */ 
  @Override 
  public Iterator<Tenor> iterator() {
    return _tenors.iterator();
  } 
 
} 
5
CodeRank
This code example shows how to use the following methods:copyOf
   * Gets the set of config keys. 
   *  
   * @return the types, not null 
   */ 
  public ImmutableSortedSet<String> getConfigTypes() {
    return ImmutableSortedSet.copyOf(_configTypeMap.keySet());
  } 
 
  /** 
   * Gets the map of config types by short key. 
   *  
   * @return the map, not null 
   */ 
  public ImmutableSortedMap<String, Class<?>> getConfigTypeMap() {
    return _configTypeMap;
  } 
 
  /** 
   * Gets the map of config descriptions by short key. 
   *  
5
CodeRank
See Code Examples for Guava ImmutableSortedSet Methods: