## org.jgroups.blocks
Class LazyRemovalSet<V>

    java.lang.Object
      org.jgroups.blocks.LazyRemovalSet<V>

    public class LazyRemovalSet<V>

extends java.lang.Object

Hash set which doesn't remove elements on remove(), removeAll() or retainAll(), but only removes elements when a configurable size limit has been exceeded. In that case, all elements marked as removable and older than a configurable time are evicted. Elements are marked as removable by remove(), removeAll() and retainAll(). When an elements is marked as removable, but later reinserted, the mark is removed.

Author:
  Bela Ban

Nested Class Summary
`protected static class` `LazyRemovalSet.Entry<V>`
`static interface` `LazyRemovalSet.Printable<V>`

Constructor Summary
`LazyRemovalSet()`
`LazyRemovalSet(int max_elements, long max_age)`

Method Summary
`void` `add(java.util.Collection<V> vals)`
`void` `add(V... vals)`
`void` `add(V val)`
`void` `clear(boolean force)`
`boolean` `contains(V val)`
`protected LazyRemovalSet.Entry<V>` `find(V val)`
`java.util.Set<V>` `nonRemovedValues()` Adds all value which have not been marked as removable to the returned set
`java.lang.String` `printCache()`
`java.lang.String` `printCache(LazyRemovalSet.Printable<V> print_function)`
`void` `remove(V val)`
`void` `remove(V val, boolean force)`
`void` `removeAll(java.util.Collection<V> values)`
`void` `removeAll(java.util.Collection<V> values, boolean force)`
`void` `removeMarkedElements()` Removes elements marked as removable
`void` `removeMarkedElements(boolean force)` Removes elements marked as removable
`void` `retainAll(java.util.Collection<V> values)`
`void` `retainAll(java.util.Collection<V> values, boolean force)`
`int` `size()`
`java.lang.String` `toString()`
`java.util.Set<V>` `values()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LazyRemovalSet

    public LazyRemovalSet()

### LazyRemovalSet

    public LazyRemovalSet(int max_elements,
                          long max_age)

Method Detail

### add

    public void add(V val)

### add

    public void add(V... vals)

### add

    public void add(java.util.Collection<V> vals)

### contains

    public boolean contains(V val)

### remove

    public void remove(V val)

### remove

    public void remove(V val,
                       boolean force)

### removeAll

    public void removeAll(java.util.Collection<V> values)

### removeAll

    public void removeAll(java.util.Collection<V> values,
                          boolean force)

### clear

    public void clear(boolean force)

### retainAll

    public void retainAll(java.util.Collection<V> values)

### retainAll

    public void retainAll(java.util.Collection<V> values,
                          boolean force)

### values

    public java.util.Set<V> values()

### nonRemovedValues

    public java.util.Set<V> nonRemovedValues()

  Adds all value which have not been marked as removable to the returned set

  Returns:

### size

    public int size()

### printCache

    public java.lang.String printCache()

### printCache

    public java.lang.String printCache(LazyRemovalSet.Printable<V> print_function)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### find

    protected LazyRemovalSet.Entry<V> find(V val)

### removeMarkedElements

    public void removeMarkedElements(boolean force)

  Removes elements marked as removable

  Parameters:
    `force` - If set to true, all elements marked as 'removable' will get removed, regardless of expiration

### removeMarkedElements

    public void removeMarkedElements()

  Removes elements marked as removable

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.