██微信号█ 158★1484★6999 ██ ██试管包出生██代孕男孩██代孕包出生███代孕选性别████试管婴儿代孕生男孩███供卵试管婴儿代孕██
LINQ to Objects (Java)
The term "LINQ to Objects" refers to the use of LINQ queries with any IEnumerable<T>
. You can use LINQ to query any enumerable collections such as Primitive Array
, Object Array
, List
, Collection
or Iterable
and so on. The collection may be user-defined or may be returned by a JDK API.
In a basic sense, LINQ to Objects represents a new approach to collections. In the old way, you had to write complex foreach
loops that specified how to retrieve data from a collection. In the LINQ approach, you write declarative code that describes what you want to retrieve.
In addition, LINQ queries offer three main advantages over traditional foreach
loops:
- They are more concise and readable, especially when filtering multiple conditions.
- They provide powerful filtering, ordering, and grouping capabilities with a minimum of application code.
- They can be ported to other data sources with little or no modification.
LINQ queries also have some advantages over stream API:
- Support
foreach
loops therefore you can break loop at any time. - IEnumerable can be traversed repeatedly.
- LINQ is very easy to use, like
ToCollection
,LeftJoin
and so on. - LINQ is faster than stream API in most cases.
In general, the more complex the operation you want to perform on the data, the more benefit you will realize by using LINQ instead of traditional iteration techniques.
Features
- Implemented all API of LINQ to Objects.
- More API supported.
- Tuple supported.
- Cast IEnumerable to stream or parallel stream supported.
API of Linq
- empty
- singleton
- asEnumerable
- range
- repeat
API of IEnumerable
forEach
stream
parallelStream
- aggregate
- any
- all
- append
- prepend
- asEnumerable
- average
- ofType
- cast
- concat
- contains
- count
- longCount
- defaultIfEmpty
- distinct
distinctBy
- elementAt
- elementAtOrDefault
- except
exceptBy
- first
- firstOrDefault
- groupBy
- groupJoin
- intersect
intersectBy
- join
leftJoin
rightJoin
fullJoin
crossJoin
- last
- lastOrDefault
- toLookup
- max
maxBy
- min
minBy
- orderBy
- orderByDescending
- reverse
- select
- selectMany
- sequenceEqual
- single
- singleOrDefault
- skip
- skipWhile
- skipLast
- sum
- take
- takeWhile
- takeLast
- toArray
- toList
- toMap
- toSet
- union
unionBy
- where
- zip
API of IGrouping extends IEnumerable
- getKey
API of ILookup extends IEnumerable
- getCount
- get
- containsKey
API of IOrderedEnumerable extends IEnumerable
- thenBy
- thenByDescending
Tuple classes
- Tuple1
- Tuple2
- Tuple3
- Tuple4
- Tuple5
- Tuple6
- Tuple7
- TupleMore
Maven
<dependency>
<groupId>com.bestvike</groupId>
<artifactId>linq</artifactId>
<version>2.0.1</version>
</dependency>