You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -56,21 +55,29 @@ final public function count(): int
56
55
}
57
56
58
57
/**
58
+
* Copies the sequence.
59
+
*
59
60
* @return static
60
61
*/
61
62
finalpublicfunctioncopy(): self
62
63
{
64
+
// Make sure the sequence is actually copied by reassigning it.
63
65
$map = $this->sequence;
64
66
65
67
return$this::fromIterable($map);
66
68
}
67
69
70
+
/**
71
+
* Returns whether or not the sequence is empty.
72
+
*/
68
73
finalpublicfunctionisEmpty(): bool
69
74
{
70
75
returncount($this->sequence) === 0;
71
76
}
72
77
73
78
/**
79
+
* Returns the sequence as an array.
80
+
*
74
81
* @return array<TKey, TValue>
75
82
*/
76
83
finalpublicfunctiontoArray(): array
@@ -79,61 +86,17 @@ final public function toArray(): array
79
86
}
80
87
81
88
/**
82
-
* @return ArrayIterator<TKey, TValue>
83
-
*/
84
-
finalpublicfunctiongetIterator(): ArrayIterator
85
-
{
86
-
returnnewArrayIterator($this->sequence);
87
-
}
88
-
89
-
/**
90
-
* @param TKey $offset
91
-
*/
92
-
finalpublicfunctionoffsetExists($offset): bool
93
-
{
94
-
returnarray_key_exists($offset, $this->sequence);
95
-
}
96
-
97
-
/**
98
-
* @param TKey $offset
89
+
* Creates a new sequence by merging this one with the provided iterable. The provided values will override the existing items in case of a key collision.
99
90
*
100
-
* @return TValue
101
-
*/
102
-
finalpublicfunctionoffsetGet($offset)
103
-
{
104
-
return$this->sequence[$offset];
105
-
}
106
-
107
-
/**
108
-
* @param TKey $offset
109
-
* @param TValue $value
110
-
*/
111
-
finalpublicfunctionoffsetSet($offset, $value)
112
-
{
113
-
thrownewBadMethodCallException(static::class.' is immutable');
114
-
}
115
-
116
-
/**
117
-
* @param string $offset
118
-
*/
119
-
finalpublicfunctionoffsetUnset($offset)
120
-
{
121
-
thrownewBadMethodCallException(static::class.' is immutable');
0 commit comments