Tabnine Logo
FastTreeMap
Code IndexAdd Tabnine to your IDE (free)

How to use
FastTreeMap
in
org.apache.commons.collections

Best Java code snippets using org.apache.commons.collections.FastTreeMap (Showing top 18 results out of 315)

origin: commons-collections/commons-collections

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: commons-collections/commons-collections

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
origin: commons-collections/commons-collections

public Map makeEmptyMap() {
  FastTreeMap ftm = new FastTreeMap();
  ftm.setFast(true);
  return (ftm);
}
origin: org.apache.cayenne/cayenne-nodeps

super.put(key, value);
return null;
origin: commons-collections/commons-collections

public Map makeEmptyMap() {
  FastTreeMap ftm = new FastTreeMap();
  ftm.setFast(false);
  return (ftm);
}
origin: org.objectstyle.cayenne/cayenne

super.put(key, value);
return null;
origin: wildfly/wildfly

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: wildfly/wildfly

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: org.apache.directory.api/api-ldap-client-all

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: org.apache.openjpa/openjpa-all

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
origin: org.apache.openjpa/openjpa-all

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: org.jboss.eap/wildfly-client-all

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Return a shallow copy of this <code>FastTreeMap</code> instance.
 * The keys and values themselves are not copied.
 * 
 * @return a clone of this map
 */
public Object clone() {
  FastTreeMap results = null;
  if (fast) {
    results = new FastTreeMap(map);
  } else {
    synchronized (map) {
      results = new FastTreeMap(map);
    }
  }
  results.setFast(getFast());
  return (results);
}
origin: com.alibaba.citrus.tool/antx-autoexpand

  public void remove() {
    if (lastReturned == null) {
      throw new IllegalStateException();
    }
    if (fast) {
      synchronized (FastTreeMap.this) {
        if (expected != map) {
          throw new ConcurrentModificationException();
        }
        FastTreeMap.this.remove(lastReturned.getKey());
        lastReturned = null;
        expected = map;
      }
    } else {
      iterator.remove();
      lastReturned = null;
    }
  }
}
org.apache.commons.collectionsFastTreeMap

Javadoc

A customized implementation of java.util.TreeMap designed to operate in a multithreaded environment where the large majority of method calls are read-only, instead of structural changes. When operating in "fast" mode, read calls are non-synchronized and write calls perform the following steps:

  • Clone the existing collection
  • Perform the modification on the clone
  • Replace the existing collection with the (modified) clone

When first created, objects of this class default to "slow" mode, where all accesses of any type are synchronized but no cloning takes place. This is appropriate for initially populating the collection, followed by a switch to "fast" mode (by calling setFast(true)) after initialization is complete.

NOTE: If you are creating and accessing a TreeMap only within a single thread, you should use java.util.TreeMap directly (with no synchronization), for maximum performance.

NOTE: This class is not cross-platform. Using it may cause unexpected failures on some architectures. It suffers from the same problems as the double-checked locking idiom. In particular, the instruction that clones the internal collection and the instruction that sets the internal reference to the clone can be executed or perceived out-of-order. This means that any read operation might fail unexpectedly, as it may be reading the state of the internal collection before the internal collection is fully formed. For more information on the double-checked locking idiom, see the Double-Checked Locking Idiom Is Broken Declaration.

Most used methods

  • <init>
    Construct a new map with the same mappings as the specified map, sorted according to the same orderi
  • setFast
    Sets whether this map is operating in fast mode.
  • getFast
    Returns true if this map is operating in fast mode.
  • remove
    Remove any mapping for this key, and return any previously mapped value.
  • put
    Associate the specified value with the specified key in this map. If the map previously contained a

Popular in Java

  • Making http requests using okhttp
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • BoxLayout (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now