Getting Collections
All query methods automatically return Collections:Basic Methods
all() - Get Native Array
count() - Count Elements
isEmpty() / isNotEmpty()
first() / last()
Filtering
filter() - Custom Filter
where() - Filter by Field
whereIn() / whereNotIn()
whereNull() / whereNotNull()
Transformations
map() - Transform Elements
pluck() - Extract Field Values
unique() - Unique Values
flatMap() - Map and Flatten
Sorting
sort() - Custom Sort
sortBy() / sortByDesc()
reverse() - Reverse Order
Slicing and Pagination
take() / skip()
slice()
chunk() - Split into Groups
forPage() - Simple Pagination
Grouping
groupBy() - Group by Field
keyBy() - Index by Field
Aggregations
sum() - Calculate Sum
avg() - Calculate Average
max() / min()
Boolean Checks
contains() - Contains Value
every() - All Match
some() - At Least One Matches
Utilities
each() - Iterate
tap() - Debug in Chain
pipe() - Custom Transformation
toArray() / toJSON()
Random Operations
random() - Random Element
shuffle() - Shuffle Collection
Set Operations
diff() - Difference
intersect() - Intersection
merge() - Merge Collections
Advanced Methods
collapse() - Flatten One Level
flatten() - Recursive Flatten
reduce() - Reduce to Value
Static Constructors
Collection.make()
Collection.wrap()
Collection.times()
Collection.range()
Practical Examples
User Dashboard
Batch Processing
Sales Report
Complex Filtering
Chainable Methods
Almost all Collection methods are chainable:Performance Tips
Filter Before Loading
Use Native Aggregates
Chunk Large Datasets
Method Reference
| Category | Methods |
|---|---|
| Basic | all(), count(), isEmpty(), isNotEmpty(), first(), last() |
| Filtering | filter(), where(), whereIn(), whereNotIn(), whereNull(), whereNotNull() |
| Transform | map(), flatMap(), pluck(), unique() |
| Sorting | sort(), sortBy(), sortByDesc(), reverse() |
| Slicing | take(), skip(), slice(), chunk(), forPage() |
| Grouping | groupBy(), keyBy() |
| Aggregation | sum(), avg(), max(), min() |
| Boolean | contains(), every(), some() |
| Utilities | each(), tap(), pipe(), toArray(), toJSON() |
| Advanced | collapse(), flatten(), reduce(), diff(), intersect(), merge() |
| Random | random(), shuffle() |