Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 80 for covariant (0.06 sec)

  1. android/guava/src/com/google/common/collect/ImmutableList.java

       */
      public static <E> ImmutableList<E> copyOf(Collection<? extends E> elements) {
        if (elements instanceof ImmutableCollection) {
          @SuppressWarnings("unchecked") // all supported methods are covariant
          ImmutableList<E> list = ((ImmutableCollection<E>) elements).asList();
          return list.isPartialView() ? ImmutableList.<E>asImmutableList(list.toArray()) : list;
        }
        return construct(elements.toArray());
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 16 21:21:17 UTC 2024
    - 27.7K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/base/Optional.java

     * href="https://github.com/google/guava/wiki/UsingAndAvoidingNullExplained#optional">using {@code
     * Optional}</a>.
     *
     * @param <T> the type of instance that can be contained. {@code Optional} is naturally covariant on
     *     this type, so it is safe to cast an {@code Optional<T>} to {@code Optional<S>} for any
     *     supertype {@code S} of {@code T}.
     * @author Kurt Alfred Kluever
     * @author Kevin Bourrillion
     * @since 10.0
     */
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 31 14:20:11 UTC 2024
    - 15.4K bytes
    - Viewed (0)
  3. guava/src/com/google/common/collect/ImmutableCollection.java

       * array with a nullable element type. But probably they usually want an array with a non-nullable
       * type. That said, we could *accept* a `@Nullable T[]` (which, given that we treat arrays as
       * covariant, would still permit a plain `T[]`) and return a plain `T[]`. But of course that would
       * require its own suppression, since it is also unsound. toArray(T[]) is just a mess from a
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Aug 12 16:59:15 UTC 2024
    - 18.8K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/collect/Multisets.java

          Multiset<? extends E> multiset) {
        if (multiset instanceof UnmodifiableMultiset || multiset instanceof ImmutableMultiset) {
          @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe
          Multiset<E> result = (Multiset<E>) multiset;
          return result;
        }
        return new UnmodifiableMultiset<>(checkNotNull(multiset));
      }
    
      /**
       * Simply returns its argument.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:05:46 UTC 2024
    - 41.7K bytes
    - Viewed (0)
  5. guava/src/com/google/common/collect/Multisets.java

          Multiset<? extends E> multiset) {
        if (multiset instanceof UnmodifiableMultiset || multiset instanceof ImmutableMultiset) {
          @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe
          Multiset<E> result = (Multiset<E>) multiset;
          return result;
        }
        return new UnmodifiableMultiset<>(checkNotNull(multiset));
      }
    
      /**
       * Simply returns its argument.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:05:46 UTC 2024
    - 41.5K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/collect/ImmutableTable.java

            checkNotNull(cell.getRowKey(), "row");
            checkNotNull(cell.getColumnKey(), "column");
            checkNotNull(cell.getValue(), "value");
            @SuppressWarnings("unchecked") // all supported methods are covariant
            Cell<R, C, V> immutableCell = (Cell<R, C, V>) cell;
            cells.add(immutableCell);
          } else {
            put(cell.getRowKey(), cell.getColumnKey(), cell.getValue());
          }
          return this;
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 17.5K bytes
    - Viewed (0)
  7. guava/src/com/google/common/collect/ImmutableList.java

       */
      public static <E> ImmutableList<E> copyOf(Collection<? extends E> elements) {
        if (elements instanceof ImmutableCollection) {
          @SuppressWarnings("unchecked") // all supported methods are covariant
          ImmutableList<E> list = ((ImmutableCollection<E>) elements).asList();
          return list.isPartialView() ? ImmutableList.<E>asImmutableList(list.toArray()) : list;
        }
        return construct(elements.toArray());
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Aug 16 19:14:45 UTC 2024
    - 30.5K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/collect/Iterators.java

          Iterator<? extends T> iterator) {
        if (iterator instanceof PeekingImpl) {
          // Safe to cast <? extends T> to <T> because PeekingImpl only uses T
          // covariantly (and cannot be subclassed to add non-covariant uses).
          @SuppressWarnings("unchecked")
          PeekingImpl<T> peeking = (PeekingImpl<T>) iterator;
          return peeking;
        }
        return new PeekingImpl<>(iterator);
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 50.3K bytes
    - Viewed (0)
  9. guava/src/com/google/common/collect/ImmutableBiMap.java

       */
      public static <K, V> ImmutableBiMap<K, V> copyOf(
          Iterable<? extends Entry<? extends K, ? extends V>> entries) {
        @SuppressWarnings("unchecked") // we'll only be using getKey and getValue, which are covariant
        Entry<K, V>[] entryArray = (Entry<K, V>[]) Iterables.toArray(entries, EMPTY_ENTRY_ARRAY);
        switch (entryArray.length) {
          case 0:
            return of();
          case 1:
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 22.6K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java

          Comparator<? super E> comparator, Iterable<? extends E> elements) {
        if (elements instanceof ImmutableSortedMultiset) {
          @SuppressWarnings("unchecked") // immutable collections are always safe for covariant casts
          ImmutableSortedMultiset<E> multiset = (ImmutableSortedMultiset<E>) elements;
          if (comparator.equals(multiset.comparator())) {
            if (multiset.isPartialView()) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 16 21:21:17 UTC 2024
    - 35.4K bytes
    - Viewed (0)
Back to top