Code example for TreeSet

Methods: addlastremovesize

0
        list = new TreeSet<PortalRequestTrace>( new PortalRequestTraceComparatorByLongestTime() );
    } 
 
    public synchronized void add( PortalRequestTrace item )
    { 
        list.add( item );
        doRetainSize(); 
    } 
 
    public synchronized List<PortalRequestTrace> getList()
    { 
        return ImmutableList.copyOf( list );
    } 
 
    private void doRetainSize() 
    { 
        if ( list.size() > maxSize )
        { 
            list.remove( list.last() );
        } 
    } 
 
    public synchronized void clear() 
    { 
Contextual code suggestions in your IDE  Get Codota for Java