collection framework

Showing posts with label collection framework. Show all posts
Showing posts with label collection framework. Show all posts

List vs Queue vs Set vs Map


 List vs Queue vs Set vs MapListQueueSetMapDuplicatesYesYesNoNo(Allow duplicate values not keys)OrderYesYesNoNoNull valuesYesPriority queue doesn't allow, but queue using LinkedList allows nullSingle nullSingle null key and many null valu...

ArrayList vs LinkedList vs Vector


ArrayList vs LinkedList vs Vector ArrayListLinkedListVectorData structureIndex-based  dynamic arrayDoubly linked listGrowable arrayIncrement size50%No initial size100%Traverse Uses iteratorUses iteratorUses enumerationMemory usageLess memory usageMore memory usageAccessibilityRandom...

Array vs ArrayList


 ArrayArrayListFixed-sizeSize is not fixedNot type-safeType-safeAllow both primitives and objectsDoesn't allow primitives. But after Java 5 auto-boxing will convert primitives to objectsType safety means the compiler will validate the types while compiling and throw an error if you do anything...

Streams vs Collections in Java


 Streams vs CollectionsCollectionsStreamsThe collections are used to store & group data in data structures like List, Set, Map...etc.Streams are used to perform complex operations like filtering, matching, mapping, etc... on stored dataData modification can be done. You can add or remove data...