Record Class Streams.IndexedElement<T>
java.lang.Object
java.lang.Record
cloud.opencode.base.collections.Streams.IndexedElement<T>
- Type Parameters:
T- element type | 元素类型- Record Components:
index- the index (0-based) | 索引(从 0 开始)value- the element value | 元素值
- Enclosing class:
Streams
An element paired with its index.
与其索引配对的元素。
- Since:
- JDK 25, opencode-base-collections V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionIndexedElement(long index, T value) Creates an instance of aIndexedElementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longindex()Returns the value of theindexrecord component.intReturns the index as an int.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
IndexedElement
-
-
Method Details
-
indexAsInt
public int indexAsInt()Returns the index as an int. May throw if index exceeds Integer.MAX_VALUE. 将索引作为 int 返回。如果索引超过 Integer.MAX_VALUE 可能会抛出异常。- Returns:
- index as int | int 形式的索引
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
index
-
value
-