Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for fromNullable (0.4 sec)

  1. 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
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 15 22:32:14 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/base/OptionalTest.java

        }
      }
    
      public void testFromNullable() {
        Optional<String> optionalName = Optional.fromNullable("bob");
        assertEquals("bob", optionalName.get());
      }
    
      public void testFromNullable_null() {
        // not promised by spec, but easier to test
        assertSame(Optional.absent(), Optional.fromNullable(null));
      }
    
      public void testIsPresent_no() {
        assertFalse(Optional.absent().isPresent());
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Feb 21 18:32:41 GMT 2024
    - 11.2K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/base/Optional.java

        return Absent.withType();
      }
    
      /**
       * Returns an {@code Optional} instance containing the given non-null reference. To have {@code
       * null} treated as {@link #absent}, use {@link #fromNullable} instead.
       *
       * <p><b>Comparison to {@code java.util.Optional}:</b> no differences.
       *
       * @throws NullPointerException if {@code reference} is null
       */
      public static <T> Optional<T> of(T reference) {
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 13K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java

      private static final Function<Object, Optional<?>> NULLABLE_TO_OPTIONAL =
          new Function<Object, Optional<?>>() {
            @Override
            public Optional<?> apply(@Nullable Object obj) {
              return Optional.fromNullable(obj);
            }
          };
    
      private static final Function<Optional<?>, @Nullable Object> OPTIONAL_TO_NULLABLE =
          new Function<Optional<?>, @Nullable Object>() {
            @Override
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Feb 20 17:00:05 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/base/OptionalTest.java

        }
      }
    
      public void testFromNullable() {
        Optional<String> optionalName = Optional.fromNullable("bob");
        assertEquals("bob", optionalName.get());
      }
    
      public void testFromNullable_null() {
        // not promised by spec, but easier to test
        assertSame(Optional.absent(), Optional.fromNullable(null));
      }
    
      public void testIsPresent_no() {
        assertFalse(Optional.absent().isPresent());
      }
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 21 18:32:41 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  6. guava/src/com/google/common/base/Optional.java

        return Absent.withType();
      }
    
      /**
       * Returns an {@code Optional} instance containing the given non-null reference. To have {@code
       * null} treated as {@link #absent}, use {@link #fromNullable} instead.
       *
       * <p><b>Comparison to {@code java.util.Optional}:</b> no differences.
       *
       * @throws NullPointerException if {@code reference} is null
       */
      public static <T> Optional<T> of(T reference) {
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 14.6K bytes
    - Viewed (0)
  7. guava-tests/test/com/google/common/cache/CacheBuilderFactory.java

      private static final Function<Object, Optional<?>> NULLABLE_TO_OPTIONAL =
          new Function<Object, Optional<?>>() {
            @Override
            public Optional<?> apply(@Nullable Object obj) {
              return Optional.fromNullable(obj);
            }
          };
    
      private static final Function<Optional<?>, @Nullable Object> OPTIONAL_TO_NULLABLE =
          new Function<Optional<?>, @Nullable Object>() {
            @Override
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Tue Feb 20 17:00:05 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/net/InternetDomainName.java

          if (i > 0
              && matchesType(
                  desiredType, Optional.fromNullable(PublicSuffixPatterns.UNDER.get(ancestorName)))) {
            return i - 1;
          }
    
          if (matchesType(
              desiredType, Optional.fromNullable(PublicSuffixPatterns.EXACT.get(ancestorName)))) {
            return i;
          }
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Feb 05 20:47:23 GMT 2024
    - 28K bytes
    - Viewed (0)
Back to top