Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for ofInstance (0.06 sec)

  1. android/guava-tests/test/com/google/common/base/SuppliersTest.java

        new EqualsTester()
            .addEqualityGroup(Suppliers.ofInstance("foo"), Suppliers.ofInstance("foo"))
            .addEqualityGroup(Suppliers.ofInstance("bar"))
            .testEquals();
      }
    
      public void testCompose_equals() {
        new EqualsTester()
            .addEqualityGroup(
                Suppliers.compose(Functions.constant(1), Suppliers.ofInstance("foo")),
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 17.9K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/util/concurrent/CallablesTest.java

      }
    
      @J2ktIncompatible
      @GwtIncompatible // threads
      public void testRenaming() throws Exception {
        String oldName = Thread.currentThread().getName();
        Supplier<String> newName = Suppliers.ofInstance("MyCrazyThreadName");
        Callable<@Nullable Void> callable =
            new Callable<@Nullable Void>() {
              @Override
              public @Nullable Void call() throws Exception {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 4.4K bytes
    - Viewed (0)
  3. guava-tests/test/com/google/common/cache/CacheBuilderSpecTest.java

      }
    
      @SuppressWarnings("ReturnValueIgnored")
      public void testMaximumWeight_withoutWeigher() {
        CacheBuilder<Object, Object> builder = CacheBuilder.from(parse("maximumWeight=9000"));
        assertThrows(
            IllegalStateException.class,
            () -> builder.build(CacheLoader.from(Suppliers.ofInstance(null))));
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Dec 19 18:03:30 UTC 2024
    - 19.1K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/cache/CacheBuilderSpecTest.java

      }
    
      @SuppressWarnings("ReturnValueIgnored")
      public void testMaximumWeight_withoutWeigher() {
        CacheBuilder<Object, Object> builder = CacheBuilder.from(parse("maximumWeight=9000"));
        assertThrows(
            IllegalStateException.class,
            () -> builder.build(CacheLoader.from(Suppliers.ofInstance(null))));
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Dec 19 18:03:30 UTC 2024
    - 19.1K bytes
    - Viewed (0)
  5. guava/src/com/google/common/base/Suppliers.java

       * supplier that is serializable, use {@code (Supplier<T> & Serializable) () -> instance}.
       */
      public static <T extends @Nullable Object> Supplier<T> ofInstance(
          @ParametricNullness T instance) {
        return new SupplierOfInstance<>(instance);
      }
    
      private static final class SupplierOfInstance<T extends @Nullable Object>
          implements Supplier<T>, Serializable {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sat Aug 09 01:14:59 UTC 2025
    - 16.5K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/base/Suppliers.java

       * supplier that is serializable, use {@code (Supplier<T> & Serializable) () -> instance}.
       */
      public static <T extends @Nullable Object> Supplier<T> ofInstance(
          @ParametricNullness T instance) {
        return new SupplierOfInstance<>(instance);
      }
    
      private static final class SupplierOfInstance<T extends @Nullable Object>
          implements Supplier<T>, Serializable {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sat Aug 09 01:14:59 UTC 2025
    - 16.5K bytes
    - Viewed (0)
  7. guava-tests/test/com/google/common/base/FunctionsTest.java

        new EqualsTester()
            .addEqualityGroup(function, Functions.forSupplier(supplier))
            .addEqualityGroup(Functions.forSupplier(new CountingSupplier()))
            .addEqualityGroup(Functions.forSupplier(Suppliers.ofInstance(12)))
            .addEqualityGroup(Functions.toStringFunction())
            .testEquals();
      }
    
      @J2ktIncompatible
      @GwtIncompatible // SerializableTester
      public void testForSupplierSerializable() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 15.9K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/base/FunctionsTest.java

        new EqualsTester()
            .addEqualityGroup(function, Functions.forSupplier(supplier))
            .addEqualityGroup(Functions.forSupplier(new CountingSupplier()))
            .addEqualityGroup(Functions.forSupplier(Suppliers.ofInstance(12)))
            .addEqualityGroup(Functions.toStringFunction())
            .testEquals();
      }
    
      @J2ktIncompatible
      @GwtIncompatible // SerializableTester
      public void testForSupplierSerializable() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 15.9K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java

      }
    
      public void testThreadRenaming() {
        Executor renamingExecutor =
            renamingDecorator(newDirectExecutorService(), Suppliers.ofInstance("FooBar"));
        String oldName = Thread.currentThread().getName();
        renamingExecutor.execute(
            new Runnable() {
              @Override
              public void run() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Tue May 13 18:46:00 UTC 2025
    - 28K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/cache/CacheBuilder.java

      @SuppressWarnings("GoodTime") // should be a Duration
      private static final int DEFAULT_REFRESH_NANOS = 0;
    
      static final Supplier<? extends StatsCounter> NULL_STATS_COUNTER =
          Suppliers.ofInstance(
              new StatsCounter() {
                @Override
                public void recordHits(int count) {}
    
                @Override
                public void recordMisses(int count) {}
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 51.7K bytes
    - Viewed (0)
Back to top