Tabnine Logo
Collections.synchronizedSortedMap
Code IndexAdd Tabnine to your IDE (free)

How to use
synchronizedSortedMap
method
in
java.util.Collections

Best Java code snippets using java.util.Collections.synchronizedSortedMap (Showing top 20 results out of 648)

origin: org.codehaus.groovy/groovy

/**
 * A convenience method for creating a synchronized SortedMap.
 *
 * @param self a SortedMap
 * @return a synchronized SortedMap
 * @see java.util.Collections#synchronizedSortedMap(java.util.SortedMap)
 * @since 1.0
 */
public static <K,V> SortedMap<K,V> asSynchronized(SortedMap<K,V> self) {
  return Collections.synchronizedSortedMap(self);
}
origin: commons-collections/commons-collections

/**
 * Returns a synchronized sorted map backed by the given sorted map.
 * <p>
 * You must manually synchronize on the returned buffer's iterator to 
 * avoid non-deterministic behavior:
 *  
 * <pre>
 * Map m = MapUtils.synchronizedSortedMap(myMap);
 * Set s = m.keySet();  // outside synchronized block
 * synchronized (m) {  // synchronized on MAP!
 *     Iterator i = s.iterator();
 *     while (i.hasNext()) {
 *         process (i.next());
 *     }
 * }
 * </pre>
 * 
 * This method uses the implementation in {@link java.util.Collections Collections}.
 * 
 * @param map  the map to synchronize, must not be null
 * @return a synchronized map backed by the given map
 * @throws IllegalArgumentException  if the map is null
 */
public static Map synchronizedSortedMap(SortedMap map) {
  return Collections.synchronizedSortedMap(map);
}
origin: wildfly/wildfly

/**
 * Returns a synchronized sorted map backed by the given sorted map.
 * <p>
 * You must manually synchronize on the returned buffer's iterator to 
 * avoid non-deterministic behavior:
 *  
 * <pre>
 * Map m = MapUtils.synchronizedSortedMap(myMap);
 * Set s = m.keySet();  // outside synchronized block
 * synchronized (m) {  // synchronized on MAP!
 *     Iterator i = s.iterator();
 *     while (i.hasNext()) {
 *         process (i.next());
 *     }
 * }
 * </pre>
 * 
 * This method uses the implementation in {@link java.util.Collections Collections}.
 * 
 * @param map  the map to synchronize, must not be null
 * @return a synchronized map backed by the given map
 * @throws IllegalArgumentException  if the map is null
 */
public static Map synchronizedSortedMap(SortedMap map) {
  return Collections.synchronizedSortedMap(map);
}
origin: org.apache.commons/commons-collections4

/**
 * Returns a synchronized sorted map backed by the given sorted map.
 * <p>
 * You must manually synchronize on the returned buffer's iterator to
 * avoid non-deterministic behavior:
 *
 * <pre>
 * Map m = MapUtils.synchronizedSortedMap(myMap);
 * Set s = m.keySet();  // outside synchronized block
 * synchronized (m) {  // synchronized on MAP!
 *     Iterator i = s.iterator();
 *     while (i.hasNext()) {
 *         process (i.next());
 *     }
 * }
 * </pre>
 *
 * This method uses the implementation in {@link java.util.Collections Collections}.
 *
 * @param <K>  the key type
 * @param <V>  the value type
 * @param map  the map to synchronize, must not be null
 * @return a synchronized map backed by the given map
 * @throws NullPointerException  if the map is null
 */
public static <K, V> SortedMap<K, V> synchronizedSortedMap(final SortedMap<K, V> map) {
  return Collections.synchronizedSortedMap(map);
}
origin: wildfly/wildfly

classes.add(Collections.synchronizedNavigableSet(Collections.emptyNavigableSet()).getClass());
classes.add(Collections.synchronizedSet(Collections.emptySet()).getClass());
classes.add(Collections.synchronizedSortedMap(Collections.emptySortedMap()).getClass());
classes.add(Collections.synchronizedSortedSet(Collections.emptySortedSet()).getClass());
origin: protostuff/protostuff

PojoWithObjectMapFields fill()
{
  TreeMap<String, String> tm = new TreeMap<String, String>();
  tm.put("foo", "bar");
  EnumMap<GuitarPickup, Size> em = new EnumMap<GuitarPickup, Size>(
      GuitarPickup.class);
  em.put(GuitarPickup.CONTACT, Size.SMALL);
  emptyMap = Collections.emptyMap();
  singletonMap = Collections.singletonMap("key", "value");
  unmodifiableMap = Collections.unmodifiableMap(Collections
      .emptyMap());
  unmodifiableSortedMap = Collections.unmodifiableSortedMap(tm);
  synchronizedMap = Collections.synchronizedMap(em);
  synchronizedSortedMap = Collections.synchronizedSortedMap(tm);
  checkedMap = Collections.checkedMap(em, GuitarPickup.class,
      Size.class);
  checkedSortedMap = Collections.checkedSortedMap(tm, String.class,
      String.class);
  return this;
}
origin: spring-projects/spring-roo

/**
 * Create a base 64 encoded SHA1 hash key for a given XML element. The key
 * is based on the element name, the attribute names and their values. Child
 * elements are ignored. Attributes named 'z' are not concluded since they
 * contain the hash key itself.
 *
 * @param element The element to create the base 64 encoded hash key for
 * @return the unique key
 */
public static String calculateUniqueKeyFor(final Element element) {
 final StringBuilder sb = new StringBuilder();
 sb.append(element.getTagName());
 final NamedNodeMap attributes = element.getAttributes();
 final SortedMap<String, String> attrKVStore =
   Collections.synchronizedSortedMap(new TreeMap<String, String>());
 for (int i = 0, n = attributes.getLength(); i < n; i++) {
  final Node attr = attributes.item(i);
  if (!"z".equals(attr.getNodeName()) && !attr.getNodeName().startsWith("_")) {
   attrKVStore.put(attr.getNodeName(), attr.getNodeValue());
  }
 }
 for (final Entry<String, String> entry : attrKVStore.entrySet()) {
  sb.append(entry.getKey()).append(entry.getValue());
 }
 return Base64.encodeBase64String(sha1(sb.toString().getBytes()));
}
origin: apache/accumulo

.synchronizedSortedMap(new TreeMap<>());
 .synchronizedSortedMap(new TreeMap<>());
origin: de.javakaffee/kryo-serializers

  @Override
  public Object create( final Object sourceCollection ) {
    return Collections.synchronizedSortedMap( (SortedMap<?, ?>) sourceCollection );
  }
};
origin: magro/kryo-serializers

  @Override
  public Object create( final Object sourceCollection ) {
    return Collections.synchronizedSortedMap( (SortedMap<?, ?>) sourceCollection );
  }
};
origin: net.java.dev/pdf-renderer

/** Creates a new instance of NameTable */
protected NameTable() {
  super (TrueTypeTable.NAME_TABLE);
  
  records = Collections.synchronizedSortedMap(new TreeMap<NameRecord,String>());
}
 
origin: com.github.rjolly/pdf-renderer

/** Creates a new instance of NameTable */
protected NameTable() {
  super (TrueTypeTable.NAME_TABLE);
  
  records = Collections.synchronizedSortedMap(new TreeMap<NameRecord,String>());
}

origin: tflobbe/solrmeter

@Inject
public OperationTimeHistory() {
  queriesTime = Collections.synchronizedSortedMap(new TreeMap<Long, Long>());
  updatesTime = Collections.synchronizedSortedMap(new TreeMap<Long, Long>());
  commitTime = Collections.synchronizedSortedMap(new TreeMap<Long, Long>());
  optimizeTime = Collections.synchronizedSortedMap(new TreeMap<Long, Long>());
  initTime = new Date().getTime();
}
origin: stackoverflow.com

 SortedMap<String, String> treeMap = new TreeMap<String, String>();
// prints true
System.out.println(treeMap.keySet() instanceof SortedSet);   
// prints false
System.out.println(Collections.synchronizedSortedMap(treeMap).keySet() instanceof SortedSet);
origin: com.github.rjolly/pdf-renderer

/** Creates a new instance of CmapTable */
protected CmapTable() {
  super(TrueTypeTable.CMAP_TABLE);
  
  setVersion((short) 0x0);

  subtables = Collections.synchronizedSortedMap(new TreeMap<CmapSubtable,CMap>());
}

origin: net.sf.taverna.t2.component/component-activity

@Override
public final SortedMap<Integer, Version> getComponentVersionMap() {
  synchronized (versionMap) {
    checkComponentVersionMap();
    return synchronizedSortedMap(versionMap);
  }
}
origin: org.maltparser/maltparser

public SortedMap<ColumnDescription, String> getLabels() {
  SortedMap<ColumnDescription, String> nodeLabels = Collections.synchronizedSortedMap(new TreeMap<ColumnDescription, String>());
  for (Integer key : labels.keySet()) {
    nodeLabels.put(graph.getDataFormat().getColumnDescription(key), labels.get(key));
  }
  return nodeLabels;
}

origin: org.kaazing/snmp4j-agent

public DefaultMOServer() {
 this.registry =
   Collections.synchronizedSortedMap(new TreeMap(new MOScopeComparator()));
 this.contexts = new LinkedHashSet(10);
 this.lockList = new Hashtable(10);
}
origin: org.terracotta.modules/tim-tree-map-cache

protected TerracottaTreeCache(boolean isThreadSafe) {        
  if (isThreadSafe) {
    cacheTree = Collections.synchronizedSortedMap(new TreeMap<Fqn,Map>(new Fqn()));
    fqnSet = Collections.synchronizedSortedSet(new TreeSet<Fqn>(new Fqn()));
  } else {
    cacheTree = new TreeMap<Fqn,Map>(new Fqn());
    fqnSet = new TreeSet<Fqn>(new Fqn());
  }
}
origin: apache/asterixdb

private MetadataProperties mockMetadataProperties() {
  SortedMap<Integer, ClusterPartition> clusterPartitions = Collections.synchronizedSortedMap(new TreeMap<>());
  Map<String, ClusterPartition[]> nodePartitionsMap = new ConcurrentHashMap<>();
  nodePartitionsMap.put(METADATA_NODE, new ClusterPartition[] { new ClusterPartition(0, METADATA_NODE, 0) });
  MetadataProperties metadataProperties = Mockito.mock(MetadataProperties.class);
  Mockito.when(metadataProperties.getMetadataNodeName()).thenReturn(METADATA_NODE);
  Mockito.when(metadataProperties.getClusterPartitions()).thenReturn(clusterPartitions);
  Mockito.when(metadataProperties.getNodePartitions()).thenReturn(nodePartitionsMap);
  return metadataProperties;
}
java.utilCollectionssynchronizedSortedMap

Javadoc

Returns a wrapper on the specified sorted map which synchronizes all access to the sorted map.

Popular methods of Collections

  • emptyList
    Returns the empty list (immutable). This list is serializable.This example illustrates the type-safe
  • sort
  • singletonList
    Returns an immutable list containing only the specified object. The returned list is serializable.
  • unmodifiableList
    Returns an unmodifiable view of the specified list. This method allows modules to provide users with
  • emptyMap
    Returns the empty map (immutable). This map is serializable.This example illustrates the type-safe w
  • emptySet
    Returns the empty set (immutable). This set is serializable. Unlike the like-named field, this metho
  • unmodifiableMap
    Returns an unmodifiable view of the specified map. This method allows modules to provide users with
  • singleton
    Returns an immutable set containing only the specified object. The returned set is serializable.
  • unmodifiableSet
    Returns an unmodifiable view of the specified set. This method allows modules to provide users with
  • singletonMap
    Returns an immutable map, mapping only the specified key to the specified value. The returned map is
  • addAll
    Adds all of the specified elements to the specified collection. Elements to be added may be specifie
  • reverse
    Reverses the order of the elements in the specified list. This method runs in linear time.
  • addAll,
  • reverse,
  • unmodifiableCollection,
  • shuffle,
  • enumeration,
  • list,
  • synchronizedMap,
  • synchronizedList,
  • reverseOrder,
  • emptyIterator

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Top Vim 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