Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for expandedCapacity (0.05 sec)

  1. guava-tests/test/com/google/common/collect/ImmutableCollectionTest.java

        assertEquals(1, ImmutableCollection.Builder.expandedCapacity(0, 1));
        assertEquals(2, ImmutableCollection.Builder.expandedCapacity(0, 2));
        assertEquals(2, ImmutableCollection.Builder.expandedCapacity(1, 2));
        assertEquals(
            Integer.MAX_VALUE, ImmutableCollection.Builder.expandedCapacity(0, Integer.MAX_VALUE));
        assertEquals(
            Integer.MAX_VALUE, ImmutableCollection.Builder.expandedCapacity(1, Integer.MAX_VALUE));
        assertEquals(
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Dec 19 18:03:30 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/collect/ImmutableCollection.java

         * current array, create a new array.
         */
        private void ensureRoomFor(int newElements) {
          @Nullable Object[] contents = this.contents;
          int newCapacity = expandedCapacity(contents.length, size + newElements);
          // expandedCapacity handles the overflow case
          if (newCapacity > contents.length || forceCopy) {
            this.contents = Arrays.copyOf(this.contents, newCapacity);
            forceCopy = false;
          }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 21.4K bytes
    - Viewed (0)
  3. guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java

      /** GWT emulated version of {@link ImmutableCollection.Builder}. */
      public abstract static class Builder<E> {
        static final int DEFAULT_INITIAL_CAPACITY = 4;
    
        Builder() {}
    
        static int expandedCapacity(int oldCapacity, int minCapacity) {
          if (minCapacity < 0) {
            throw new AssertionError("cannot store more than MAX_VALUE elements");
          }
          // careful of overflow!
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Wed Aug 06 18:32:41 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/primitives/ImmutableLongArray.java

          if (newCount > array.length) {
            array = Arrays.copyOf(array, expandedCapacity(array.length, newCount));
          }
        }
    
        // Unfortunately this is pasted from ImmutableCollection.Builder.
        private static int expandedCapacity(int oldCapacity, int minCapacity) {
          if (minCapacity < 0) {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sat Aug 09 01:14:59 UTC 2025
    - 22K bytes
    - Viewed (0)
  5. guava/src/com/google/common/primitives/ImmutableIntArray.java

          if (newCount > array.length) {
            array = Arrays.copyOf(array, expandedCapacity(array.length, newCount));
          }
        }
    
        // Unfortunately this is pasted from ImmutableCollection.Builder.
        private static int expandedCapacity(int oldCapacity, int minCapacity) {
          if (minCapacity < 0) {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sat Aug 09 01:14:59 UTC 2025
    - 21.4K bytes
    - Viewed (0)
  6. guava/src/com/google/common/base/Joiner.java

               * sync with one another). We accommodate that by resizing as necessary.
               */
              toJoin = Arrays.copyOf(toJoin, expandedCapacity(toJoin.length, toJoin.length + 1));
            }
            toJoin[i++] = toString(part);
          }
          // We might not have seen the expected number of elements, as discussed above.
          if (i != toJoin.length) {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Apr 14 15:16:19 UTC 2025
    - 21K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/collect/HashBiMap.java

       */
      private void ensureCapacity(int minCapacity) {
        if (nextInBucketKToV.length < minCapacity) {
          int oldCapacity = nextInBucketKToV.length;
          int newCapacity = ImmutableCollection.Builder.expandedCapacity(oldCapacity, minCapacity);
    
          keys = Arrays.copyOf(keys, newCapacity);
          values = Arrays.copyOf(values, newCapacity);
          nextInBucketKToV = expandAndFillWithAbsent(nextInBucketKToV, newCapacity);
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 36.2K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/base/Joiner.java

              case 1:
                return second;
              default:
                return rest[index - 2];
            }
          }
        };
      }
    
      // cloned from ImmutableCollection
      private static int expandedCapacity(int oldCapacity, int minCapacity) {
        if (minCapacity < 0) {
          throw new IllegalArgumentException("cannot store more than Integer.MAX_VALUE elements");
        } else if (minCapacity <= oldCapacity) {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Mar 17 20:26:29 UTC 2025
    - 19.3K bytes
    - Viewed (0)
  9. guava/src/com/google/common/collect/ImmutableCollection.java

       *
       * @since 10.0
       */
      @DoNotMock
      public abstract static class Builder<E> {
        static final int DEFAULT_INITIAL_CAPACITY = 4;
    
        static int expandedCapacity(int oldCapacity, int minCapacity) {
          if (minCapacity < 0) {
            throw new IllegalArgumentException("cannot store more than Integer.MAX_VALUE elements");
          } else if (minCapacity <= oldCapacity) {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 18.7K bytes
    - Viewed (0)
  10. guava/src/com/google/common/collect/ImmutableSet.java

         * elements.
         */
        private void ensureCapacity(int minCapacity) {
          if (minCapacity > dedupedElements.length) {
            int newCapacity =
                ImmutableCollection.Builder.expandedCapacity(dedupedElements.length, minCapacity);
            dedupedElements = Arrays.copyOf(dedupedElements, newCapacity);
          }
        }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 35.2K bytes
    - Viewed (0)
Back to top