- Sort Score
- Num 10 results
- Language All
Results 1 - 4 of 4 for fromNullable (0.08 seconds)
-
guava/src/com/google/common/base/Platform.java
} static <T extends Enum<T>> Optional<T> getEnumIfPresent(Class<T> enumClass, String value) { WeakReference<? extends Enum<?>> ref = Enums.getEnumConstants(enumClass).get(value); /* * We use `fromNullable` instead of `of` because `WeakReference.get()` has a nullable return * type. * * In practice, we are very unlikely to see `null`: The `WeakReference` to the enum constant
Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Mon Dec 29 17:36:00 GMT 2025 - 3.7K bytes - Click Count (0) -
android/guava/src/com/google/common/base/Platform.java
} static <T extends Enum<T>> Optional<T> getEnumIfPresent(Class<T> enumClass, String value) { WeakReference<? extends Enum<?>> ref = Enums.getEnumConstants(enumClass).get(value); /* * We use `fromNullable` instead of `of` because `WeakReference.get()` has a nullable return * type. * * In practice, we are very unlikely to see `null`: The `WeakReference` to the enum constant
Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Mon Dec 29 17:36:00 GMT 2025 - 4.1K bytes - Click Count (0) -
android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java
List<Set<Optional<?>>> optionalSets = Lists.newArrayListWithExpectedSize(sets.length); for (Set<?> set : sets) { Set<Optional<?>> optionalSet = Sets.newLinkedHashSet(Iterables.transform(set, Optional::fromNullable)); optionalSets.add(optionalSet); } Set<List<Optional<?>>> cartesianProduct = Sets.cartesianProduct(optionalSets);
Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Wed Mar 18 18:06:14 GMT 2026 - 7.5K bytes - Click Count (0) -
android/guava-tests/test/com/google/common/base/OptionalTest.java
} public void testFromNullable() { Optional<String> optionalName = Optional.fromNullable("bob"); assertThat(optionalName.get()).isEqualTo("bob"); } public void testFromNullable_null() { // not promised by spec, but easier to test assertThat(Optional.fromNullable(null)).isSameInstanceAs(Optional.absent()); } public void testIsPresent_no() {
Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Mon Mar 16 15:59:55 GMT 2026 - 10.6K bytes - Click Count (0)