2:32 am - Friday April 19, 2019

Collections example programs | Java Collections tutorials

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

 Java Collection tutorials:

AddAll()

For Insert a collection element in already excisting collection

LifoQueue()

For View of Deque in Last-in-first-out order

binarySearch(List<? extends T>,T,Comparator<?super T>

For  Search a particular list in collection

boolean replaceAll(List<T>list,T oldVal,T newVal)

For Replace all value with another list in collection using public static <T>

 void swap(List<?> list,int i, int j)

For Swap the element in collection using public static

void copy(List<? super T>dest, List<? extends T>src)

For Copy the elements from one to another in collection using public static <T>

checkedCollection(Collection<E> c, Class<E>type)

Dynamically typesafe view in collection using public static <E> Collection<E>

checkedMap(Map<K,V> m, Class<K> keyType, Class<V> valueType)

Typesafe view by specified Map in collection public static <K,V>Map<k,v>

void reverse(list<?> list)

Reverse the order of elements in collection using public static

void fill(List<? super T> list,T obj)

Replace all elements of a list using  public static<T>

checkedList(List<E>, Class<E>)

For get a dynamically typesafe view of the specified list

checkedSortedMap(SortedMap<, V>, Class<K>, Class<V>)

For get a dynamically typesafe view of the specified sorted map

disjoint(Collection<?>, Collection<?>)

This Program is used to ‘true’ if the two specified collections have no elements in common

emptyMap() 

This Program is used to get the empty map (immutable)

max() Method

This Collection Program is used to get the max elements

min() Method

This Collection Program is used to get the min elements

min(Collection <? extends T> coll, Comparator <? super T> comp)

returns the minimum element of the given collection

Collections.ncopies()

This Program is used to copying the number of lists

newSetFromMap() 

This Collections Program is used to set the elements

unmodifiableCollection(Collection<? extends T> c)

This unmodifiableCollection() method is used to return an unmodifiable view of the specified  collection

unmodifiableList(List<? extends T> list)

This unmodifiableList() method is used to returns an unmodifiable view of the specified list

synchronizedSortedSet(SortedSet<T> s)

This SortedSet interface extends Set and declares the behavior of a set sorted in ascending order

unmodifiableMap(Map<? extends K,? extends V> m)

This unmodifiableMap() method is used to return an unmodifiable view of the specified map in descending order

 unmodifiableSet(Set<? extends T> s)

This unmodifiableSet() method Returns an unmodifiable view of the specified set in Descending order

unmodifiableSortedMap(SortedMap<K,? extends V> m)

This unmodifiableSortedMap() method is used to return an unmodifiable view of the specified sorted map. in ascending order

SingletonList(T o) method.

This Collection Program Singleton  used to return an immutable list containing only the specified object

singleton(T o) method

This Collection  Program Silgleton Returns an immutable set containing only the specified object

singletonMap(K, V) method

This Collection Program singletonMap used to get an immutable map, mapping only the specified key to the specified value

sort(List<T> list)

This Collection Program Sorts the specified list into ascending order, according to the natural ordering of its elements

sort(List<T> list, Comparator<? super T> c) method

This Collection Program sort the specified list according to the order induced by the specified comparator

subList(int fromIndex,int toIndex) method

This Java Program is used to return a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive

Object[] toArray() 

This Java Program returns an array containing all of the elements in this collection

 <T> T[] toArray(T[] a) method

This Java Program returns an array containing all of the elements in this list in proper sequence (from first to last element)

trimToSize() 

This Java Program is used for memory optimization. It trims the capacity ofArrayList to the current list size.

 

BACK

Filed in: Java Examples

Comments are closed.