#collections

25 snippets tagged with #collections

pythonbeginner

Collections Module Patterns

Use Counter, defaultdict, deque, namedtuple, and ChainMap from the collections module.

Best for: counting

#python#collections
javabeginner

HashMap Operations and Patterns

Essential HashMap operations: put, get, merge, compute, getOrDefault, and iteration patterns.

Best for: Counting word frequencies in text

#java#collections
javabeginner

Java Streams — Filter, Map, Collect

Process collections with Java Streams: filter, map, flatMap, reduce, and collect to lists or maps.

Best for: Transforming and filtering collections

#java#streams
javaadvanced

Concurrent Collections — Thread-Safe Maps

Use ConcurrentHashMap, CopyOnWriteArrayList, and BlockingQueue for thread-safe data structures.

Best for: Thread-safe caching in multi-threaded applications

#java#concurrency
javaadvanced

Java Generics — Bounded Types and Wildcards

Master Java generics: bounded types, wildcards, generic methods, and type-safe collection utilities.

Best for: Type-safe generic utility methods and classes

#java#generics
javabeginner

Java List Operations and Utilities

Essential List operations: create, sort, search, transform, partition, and immutable list patterns.

Best for: Common list manipulation patterns

#java#collections
javabeginner

Comparator Chains — Multi-Field Sorting

Sort objects by multiple fields using Comparator.comparing, thenComparing, and custom comparators.

Best for: Multi-field sorting for display and reporting

#java#sorting
javaintermediate

Java Map — Advanced Operations

Master Map operations: compute, merge, getOrDefault, multi-map, BiMap, and stream-based grouping.

Best for: Aggregation and grouping operations on data

#java#map
javaintermediate

Custom Iterator and Iterable

Implement custom iterators and iterables for specialized data traversal and lazy sequence generation.

Best for: Lazy sequence generation for large datasets

#java#iterator
javaintermediate

MultiMap and BiMap Implementations

Implement MultiMap and BiMap data structures for one-to-many and bidirectional key-value mappings.

Best for: Tag/category systems with multiple values per key

#java#collections
kotlinbeginner

Collections — map, filter, groupBy, and More

Master Kotlin collections: functional transformations, aggregations, grouping, and partition operations.

Best for: Data processing and transformation pipelines

#kotlin#collections
kotlinbeginner

Collection Builders — buildList, buildMap, buildSet

Build collections conditionally and dynamically with Kotlin collection builders.

Best for: Conditional list/map construction

#kotlin#collections
kotlinintermediate

Map Operations — Transform, Merge, Group

Advanced map operations: groupBy, associate, flatMap, merge strategies, and map transformations.

Best for: Data aggregation and grouping

#kotlin#collections
kotlinbeginner

List Transformation Patterns

Master list operations: windowed, chunked, zip, fold, scan, partition, and custom transforms.

Best for: Data processing pipelines

#kotlin#collections
kotlinintermediate

Multimap, Grouping, and Counting Patterns

Build multimaps, aggregate data, count occurrences, and perform grouped reductions in Kotlin.

Best for: Log aggregation and analysis

#kotlin#collections
kotlinbeginner

Collection Transformations and Aggregations

Master Kotlin collection operations: groupBy, partition, associate, zip, windowed, and aggregate.

Best for: Data aggregation and reporting

#kotlin#collections
scalabeginner

Collections Map Filter Fold Operations

Master Scala collections: map, flatMap, filter, fold, groupBy, partition, and zip operations.

Best for: Data transformation and aggregation

#scala#collections
scalabeginner

Map and HashMap Operations

Work with Scala Maps: create, update, merge, transform, and use default values.

Best for: Configuration management

#scala#map
scalabeginner

Set Operations and Algorithms

Perform set operations: union, intersection, difference, subsets, and practical set algorithms.

Best for: Deduplication and uniqueness

#scala#set
scalaintermediate

Thread-Safe Concurrent Collections

Use concurrent collections for thread-safe access: TrieMap, concurrent queues, and synchronized wrappers.

Best for: Thread-safe service registries

#scala#concurrent
scalabeginner

Mutable Collections and Buffers

Use mutable collections: ArrayBuffer, ListBuffer, mutable Map/Set, and when to choose mutable vs immutable.

Best for: Performance-critical collection building

#scala#mutable
scalabeginner

Java Interop and Collections

Work with Java libraries from Scala: collection conversions, null safety, and API wrapping.

Best for: Using Java libraries from Scala

#scala#java
scalabeginner

List Operations Basics

Essential list operations: head, tail, cons, zip, groupBy, sliding, partition, and span.

Best for: Data processing and transformation

#scala#list
scalabeginner

Advanced Map Operations

Advanced Map usage: merge, transform, groupMapReduce, default values, and nested maps.

Best for: Data aggregation and grouping

#scala#map
scalaintermediate

GroupBy, Partition, and Aggregate

Group, partition, and aggregate collections: groupBy, groupMapReduce, partition, and sliding aggregations.

Best for: Data analysis and reporting

#scala#collections