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

How to use
checkedCollection
method
in
java.util.Collections

Best Java code snippets using java.util.Collections.checkedCollection (Showing top 11 results out of 315)

origin: stackoverflow.com

 @SuppressWarnings("unchecked") // Just for this one statement
Collection<String> keys = Collections.checkedCollection(map.keySet(),
                            String.class);

// Now this statement is fully generic with no warnings
SortedSet<String> s = new TreeSet<String>(keys);
origin: wildfly/wildfly

List<Void> nonRandomAccessList = new LinkedList<>();
classes.add(Collections.checkedCollection(randomAccessList, Void.class).getClass());
classes.add(Collections.checkedCollection(nonRandomAccessList, Void.class).getClass());
classes.add(Collections.checkedList(randomAccessList, Void.class).getClass());
classes.add(Collections.checkedList(nonRandomAccessList, Void.class).getClass());
origin: protostuff/protostuff

    .endsWith("RandomAccessList"));
checkedCollection = Collections.checkedCollection(newList("eight"),
    String.class); // no equals impl
checkedSet = Collections.checkedSet(es, Size.class);
origin: stackoverflow.com

Collection<String> c = Collections.checkedCollection(
    new HashSet<String>(), String.class);
origin: org.glassfish.main.common/amx-core

/**
Create a checked Collection<String>, first verifying that all elements
are in fact String.
@param c the Collection
@throws ClassCastException
 */
public static <T> Collection<T> checkedCollection(final Collection<?> c, final Class<T> theClass)
{
  final Collection<T> cc = checkCollection(c, theClass);
  return Collections.checkedCollection(cc, theClass);
}
origin: org.glassfish.common/amx-core

/**
Create a checked Collection<String>, first verifying that all elements
are in fact String.
@param c the Collection
@throws ClassCastException
 */
public static <T> Collection<T> checkedCollection(final Collection<?> c, final Class<T> theClass)
{
  final Collection<T> cc = checkCollection(c, theClass);
  return Collections.checkedCollection(cc, theClass);
}
origin: com.github.rinde/rinlog

@Override
protected final void doUpdate(Set<Parcel> onMap, long time) {
 final Collection<Parcel> inCargo = Collections.checkedCollection(
  pdpModel.get().getContents(vehicle.get()), Parcel.class);
 parcels.clear();
 parcels.addAll(onMap);
 parcels.addAll(onMap);
 parcels.addAll(inCargo);
 updateCurrent();
}
origin: sdedit/sdedit

public void update() {
  dateLabel.setText(formatDate());
  for (DateSwitcherListener listener : Collections.checkedCollection(
      listeners, DateSwitcherListener.class)) {
    listener.dateSwitched(this, calendar.getTime());
  }
  dateLabel.requestFocusInWindow();
}

origin: org.wildfly/wildfly-clustering-marshalling-jboss

classes.add(Collections.checkedCollection(Collections.emptyList(), Void.class).getClass());
classes.add(Collections.checkedList(Collections.emptyList(), Void.class).getClass());
classes.add(Collections.checkedMap(Collections.emptyMap(), Void.class, Void.class).getClass());
origin: au.net.zeus.jgdms/jgdms-platform

if (type == null) throw new NullPointerException("type cannot be null");
try {
  Collection typeCheckedView = Collections.checkedCollection(destination, type);
  typeCheckedView.addAll(source);
} catch (ClassCastException ex){
origin: luisgoncalves/xades4j

crls.addAll(Collections.checkedCollection(storeCRLs, X509CRL.class));
java.utilCollectionscheckedCollection

Javadoc

Returns a dynamically typesafe view of the specified collection. Trying to insert an element of the wrong type into this collection throws a ClassCastException. At creation time the types in c are not checked for correct type.

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 plugins for WebStorm
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