- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for onlyElement (0.1 sec)
-
guava-tests/test/com/google/common/collect/MoreCollectorsTest.java
assertThrows(NoSuchElementException.class, () -> Stream.empty().collect(onlyElement())); } public void testOnlyElementSingleton() { assertThat(Stream.of(1).collect(onlyElement())).isEqualTo(1); } public void testOnlyElementNull() { assertThat(Stream.<@Nullable Object>of((Object) null).collect(onlyElement())).isNull(); } public void testOnlyElementMultiple() {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 20:24:49 UTC 2024 - 3.2K bytes - Viewed (0) -
guava-tests/benchmark/com/google/common/collect/StreamsBenchmark.java
* See the License for the specific language governing permissions and * limitations under the License. */ package com.google.common.collect; import static com.google.common.collect.MoreCollectors.onlyElement; import com.google.caliper.BeforeExperiment; import com.google.caliper.Benchmark; import com.google.caliper.Param; import com.google.caliper.api.SkipThisScenarioException; import java.util.ArrayList;
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 20:24:49 UTC 2024 - 2.8K bytes - Viewed (0) -
android/guava/src/com/google/common/collect/MoreCollectors.java
* more elements, and a {@code NoSuchElementException} if the stream is empty. */ @SuppressWarnings("unchecked") public static <T extends @Nullable Object> Collector<T, ?, T> onlyElement() { return (Collector) ONLY_ELEMENT; } /** * This atrocity is here to let us report several of the elements in the stream if there were more * than one, not just two. */
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 16 21:21:17 UTC 2024 - 5.6K bytes - Viewed (0) -
guava/src/com/google/common/collect/ImmutableList.java
* `length` array elements. */ @SuppressWarnings("unchecked") // our callers put only E instances into the array E onlyElement = (E) requireNonNull(elements[0]); return of(onlyElement); default: /* * The suppression is safe because the callers promise to put non-null objects in the first * `length` array elements. */
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Aug 16 19:14:45 UTC 2024 - 30.5K bytes - Viewed (0) -
android/guava/src/com/google/common/collect/Iterables.java
} /** * Returns the single element contained in {@code iterable}. * * <p><b>Java 8+ users:</b> the {@code Stream} equivalent to this method is {@code * stream.collect(MoreCollectors.onlyElement())}. * * @throws NoSuchElementException if the iterable is empty * @throws IllegalArgumentException if the iterable contains multiple elements */ @ParametricNullness
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Apr 24 19:38:27 UTC 2024 - 42.8K bytes - Viewed (0)