Java 类java.util.AbstractList 实例源码

项目:urdu-font-comparator-app    文件:MainFragment.java   
@OnTouch(R.id.spinner_font_names)
protected boolean onSpinnerTouchListener(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
        if (currentSelectedFont != null && builderPickerDialog != null) {
            //to update currently selected font
            builderPickerDialog.setInputs(new UniversalPickerDialog.Input(currentFontIndex,
                    (AbstractList<String>) fontNames));
            builderPickerDialog.show();
        } else {
            //fallback plan
            presenter.loadFontsAvailable();
            setFontPickerDialog();
        }
    }
    return true;
}
项目:incubator-netbeans    文件:ConnectionManagerTest.java   
public void testGetRecentConnections() throws Exception {
    String section = "remote.platforms";
    ExecutionEnvironment[] envs = NativeExecutionTestSupport.getTestExecutionEnvironmentsFromSection(section);
    assertTrue("Empty environmens list for section ", envs.length > 0);
    ConnectionManager.getInstance().clearRecentConnectionsList();
    AbstractList<ExecutionEnvironment> referenceList = new ArrayList<>();
    for (ExecutionEnvironment env : envs) {
        ConnectionManager.getInstance().updateRecentConnectionsList(env);
        referenceList.add(0, env);
    }
    List<ExecutionEnvironment> managersList = ConnectionManager.getInstance().getRecentConnections();
    assertEquals("Connections lists differ", referenceList, managersList);
    ConnectionManager.getInstance().clearRecentConnectionsList();
    assertTrue("Recent connections list should be empty", ConnectionManager.getInstance().getRecentConnections().isEmpty());
    ConnectionManager.getInstance().restoreRecentConnectionsList();
    assertEquals("Restopred connections list differ", referenceList, managersList);
}
项目:incubator-netbeans    文件:EditorDetailsProvider.java   
@Override
public List getValues() {
    final List origValues = buffer.getValues();

    return new AbstractList() {

        @Override
        public Object get(int index) {
            return origValues.get(rawOffset(index));
        }

        @Override
        public int size() {
            return getLength();
        }
    };
}
项目:incubator-netbeans    文件:JPDAClassTypeImpl.java   
@Override
public List<ObjectVariable> getInstances(long maxInstances) {
        //assert !java.awt.EventQueue.isDispatchThread() : "Instances retrieving in AWT Event Queue!";
        final List<ObjectReference> instances;
        try {
            instances = ReferenceTypeWrapper.instances(classType, maxInstances);
        } catch (ObjectCollectedExceptionWrapper | VMDisconnectedExceptionWrapper |
                 InternalExceptionWrapper ex) {
            return Collections.emptyList();
        }
        return new AbstractList<ObjectVariable>() {
            @Override
            public ObjectVariable get(int i) {
                ObjectReference obj = instances.get(i);
                return new AbstractObjectVariable(debugger, obj, classType.name()+" instance "+i);
            }

            @Override
            public int size() {
                return instances.size();
            }
        };
}
项目:sstore-soft    文件:Joiner.java   
private static Iterable<Object> iterable(
    final Object first, final Object second, final Object[] rest) {
  checkNotNull(rest);
  return new AbstractList<Object>() {
    @Override public int size() {
      return rest.length + 2;
    }

    @Override public Object get(int index) {
      switch (index) {
        case 0:
          return first;
        case 1:
          return second;
        default:
          return rest[index - 2];
      }
    }
  };
}
项目:elasticsearch_my    文件:TermsQueryBuilder.java   
/**
 * Convert the internal {@link List} of values back to a user-friendly list.
 * Integers are kept as-is since the terms query does not make any difference
 * between {@link Integer}s and {@link Long}s, but {@link BytesRef}s are
 * converted back to {@link String}s.
 */
static List<Object> convertBack(List<?> list) {
    return new AbstractList<Object>() {
        @Override
        public int size() {
            return list.size();
        }
        @Override
        public Object get(int index) {
            Object o = list.get(index);
            if (o instanceof BytesRef) {
                o = ((BytesRef) o).utf8ToString();
            }
            // we do not convert longs, all integer types are equivalent
            // as far as this query is concerned
            return o;
        }
    };
}
项目:guava-mock    文件:Throwables.java   
@GwtIncompatible // invokeAccessibleNonThrowingMethod
private static List<StackTraceElement> jlaStackTrace(final Throwable t) {
  checkNotNull(t);
  /*
   * TODO(cpovirk): Consider optimizing iterator() to catch IOOBE instead of doing bounds checks.
   *
   * TODO(cpovirk): Consider the UnsignedBytes pattern if it performs faster and doesn't cause
   * AOSP grief.
   */
  return new AbstractList<StackTraceElement>() {
    @Override
    public StackTraceElement get(int n) {
      return (StackTraceElement)
          invokeAccessibleNonThrowingMethod(getStackTraceElementMethod, jla, t, n);
    }

    @Override
    public int size() {
      return (Integer) invokeAccessibleNonThrowingMethod(getStackTraceDepthMethod, jla, t);
    }
  };
}
项目:guava-mock    文件:Joiner.java   
private static Iterable<Object> iterable(
    final Object first, final Object second, final Object[] rest) {
  checkNotNull(rest);
  return new AbstractList<Object>() {
    @Override
    public int size() {
      return rest.length + 2;
    }

    @Override
    public Object get(int index) {
      switch (index) {
        case 0:
          return first;
        case 1:
          return second;
        default:
          return rest[index - 2];
      }
    }
  };
}
项目:guava-mock    文件:TestsForListsInJavaUtil.java   
public Test testsForAbstractList() {
  return ListTestSuiteBuilder.using(
          new TestStringListGenerator() {
            @Override
            protected List<String> create(final String[] elements) {
              return new AbstractList<String>() {
                @Override
                public int size() {
                  return elements.length;
                }

                @Override
                public String get(int index) {
                  return elements[index];
                }
              };
            }
          })
      .named("AbstractList")
      .withFeatures(
          CollectionFeature.NONE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY)
      .suppressing(suppressForAbstractList())
      .createTestSuite();
}
项目:guava-mock    文件:EvictingQueueTest.java   
public void testAddAll_largeList() {
  final List<String> list = ImmutableList.of("one", "two", "three", "four", "five");
  List<String> misbehavingList =
      new AbstractList<String>() {
        @Override
        public int size() {
          return list.size();
        }

        @Override
        public String get(int index) {
          if (index < 2) {
            throw new AssertionError();
          }
          return list.get(index);
        }
      };

  EvictingQueue<String> queue = EvictingQueue.create(3);
  assertTrue(queue.addAll(misbehavingList));

  assertEquals("three", queue.remove());
  assertEquals("four", queue.remove());
  assertEquals("five", queue.remove());
  assertTrue(queue.isEmpty());
}
项目:oscm    文件:LocalizerServiceBean.java   
public List<Long> getAllObjKeys() {
    return new AbstractList<Long>() {

        @Override
        public Long get(int index) {
            if (index == 0) {
                return primaryObjKey;
            }
            return fallBackObjKeys.get(index - 1);
        }

        @Override
        public Spliterator<Long> spliterator() {
            return super.spliterator();
        }

        @Override
        public int size() {
            return fallBackObjKeys.size() + 1;
        }

    };
}
项目:org.alloytools.alloy    文件:TwosComplementInt.java   
/**
 * {@inheritDoc}
 * 
 * @see kodkod.engine.bool.Int#twosComplementBits()
 */
@Override
public final List<BooleanValue> twosComplementBits() {
    return new AbstractList<BooleanValue>() {
        @Override
        public BooleanValue get(int i) {
            if (i < 0 || i >= factory.bitwidth)
                throw new IndexOutOfBoundsException();
            return bit(i);
        }

        @Override
        public int size() {
            return factory.bitwidth;
        }
    };
}
项目:s-store    文件:Joiner.java   
private static Iterable<Object> iterable(
    final Object first, final Object second, final Object[] rest) {
  checkNotNull(rest);
  return new AbstractList<Object>() {
    @Override public int size() {
      return rest.length + 2;
    }

    @Override public Object get(int index) {
      switch (index) {
        case 0:
          return first;
        case 1:
          return second;
        default:
          return rest[index - 2];
      }
    }
  };
}
项目:OpenJSharp    文件:ClassInfoImpl.java   
/**
 * Report errors for unused propOrder entries.
 */
public void checkUnusedProperties() {
    for( int i=0; i<used.length; i++ )
        if(used[i]==null) {
            String unusedName = propOrder[i];
            String nearest = EditDistance.findNearest(unusedName, new AbstractList<String>() {
                public String get(int index) {
                    return properties.get(index).getName();
                }

                public int size() {
                    return properties.size();
                }
            });
            boolean isOverriding = (i > (properties.size()-1)) ? false : properties.get(i).hasAnnotation(OverrideAnnotationOf.class);
            if (!isOverriding) {
                builder.reportError(new IllegalAnnotationException(
                Messages.PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY.format(unusedName,nearest),ClassInfoImpl.this));
            }
        }
}
项目:openjdk-jdk10    文件:InternetHeaders.java   
/**
 * Return all the header lines as a collection
 *
 * @return list of header lines.
 */
public List<String> getAllHeaderLines() {
    if (headerValueView == null)
        headerValueView = new AbstractList<String>() {
            @Override
            public String get(int index) {
                return headers.get(index).line;
            }

            @Override
            public int size() {
                return headers.size();
            }
        };
    return headerValueView;
}
项目:openjdk-jdk10    文件:ClassInfoImpl.java   
/**
 * Report errors for unused propOrder entries.
 */
public void checkUnusedProperties() {
    for( int i=0; i<used.length; i++ )
        if(used[i]==null) {
            String unusedName = propOrder[i];
            String nearest = EditDistance.findNearest(unusedName, new AbstractList<String>() {
                public String get(int index) {
                    return properties.get(index).getName();
                }

                public int size() {
                    return properties.size();
                }
            });
            boolean isOverriding = (i > (properties.size()-1)) ? false : properties.get(i).hasAnnotation(OverrideAnnotationOf.class);
            if (!isOverriding) {
                builder.reportError(new IllegalAnnotationException(
                Messages.PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY.format(unusedName,nearest),ClassInfoImpl.this));
            }
        }
}
项目:calcite-avatica    文件:Spaces.java   
/**
 * Populates this list with all prefix strings of a given string. All
 * of the prefix strings share the same backing array of chars.
 */
private synchronized void populate(int newSize) {
  final int size = size();
  if (newSize <= size) {
    return;
  }
  final char[] chars = new char[newSize];
  Arrays.fill(chars, ' ');
  final int length = newSize - size;
  final int offset = size;

  // addAll is much more efficient than repeated add for
  // CopyOnWriteArrayList
  addAll(
      new AbstractList<String>() {
        public String get(int index) {
          return new String(chars, 0, offset + index);
        }

        public int size() {
          return length;
        }
      });
}
项目:SparkSeq    文件:Utils.java   
/**
 * Returns a {@link List List&lt;Integer&gt;} representation of an primitive int array.
 * @param values the primitive int array to represent.
 * @return never code {@code null}. The returned list will be unmodifiable yet it will reflect changes in values in the original array yet
 *   you cannot change the values
 */
public static List<Integer> asList(final int ... values) {
    if (values == null)
        throw new IllegalArgumentException("the input array cannot be null");
    return new AbstractList<Integer>() {

        @Override
        public Integer get(final int index) {
            return values[index];
        }

        @Override
        public int size() {
            return values.length;
        }
    };
}
项目:SparkSeq    文件:Utils.java   
/**
 * Returns a {@link List List&lt;Double&gt;} representation of an primitive double array.
 * @param values the primitive int array to represent.
 * @return never code {@code null}. The returned list will be unmodifiable yet it will reflect changes in values in the original array yet
 *   you cannot change the values.
 */
public static List<Double> asList(final double ... values) {
    if (values == null)
        throw new IllegalArgumentException("the input array cannot be null");
    return new AbstractList<Double>() {

        @Override
        public Double get(final int index) {
            return values[index];
        }

        @Override
        public int size() {
            return values.length;
        }
    };
}
项目:googles-monorepo-demo    文件:Throwables.java   
@GwtIncompatible // invokeAccessibleNonThrowingMethod
private static List<StackTraceElement> jlaStackTrace(final Throwable t) {
  checkNotNull(t);
  /*
   * TODO(cpovirk): Consider optimizing iterator() to catch IOOBE instead of doing bounds checks.
   *
   * TODO(cpovirk): Consider the UnsignedBytes pattern if it performs faster and doesn't cause
   * AOSP grief.
   */
  return new AbstractList<StackTraceElement>() {
    @Override
    public StackTraceElement get(int n) {
      return (StackTraceElement)
          invokeAccessibleNonThrowingMethod(getStackTraceElementMethod, jla, t, n);
    }

    @Override
    public int size() {
      return (Integer) invokeAccessibleNonThrowingMethod(getStackTraceDepthMethod, jla, t);
    }
  };
}
项目:googles-monorepo-demo    文件:Joiner.java   
private static Iterable<Object> iterable(
    final Object first, final Object second, final Object[] rest) {
  checkNotNull(rest);
  return new AbstractList<Object>() {
    @Override
    public int size() {
      return rest.length + 2;
    }

    @Override
    public Object get(int index) {
      switch (index) {
        case 0:
          return first;
        case 1:
          return second;
        default:
          return rest[index - 2];
      }
    }
  };
}
项目:googles-monorepo-demo    文件:TestsForListsInJavaUtil.java   
public Test testsForAbstractList() {
  return ListTestSuiteBuilder.using(
          new TestStringListGenerator() {
            @Override
            protected List<String> create(final String[] elements) {
              return new AbstractList<String>() {
                @Override
                public int size() {
                  return elements.length;
                }

                @Override
                public String get(int index) {
                  return elements[index];
                }
              };
            }
          })
      .named("AbstractList")
      .withFeatures(
          CollectionFeature.NONE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY)
      .suppressing(suppressForAbstractList())
      .createTestSuite();
}
项目:googles-monorepo-demo    文件:EvictingQueueTest.java   
public void testAddAll_largeList() {
  final List<String> list = ImmutableList.of("one", "two", "three", "four", "five");
  List<String> misbehavingList =
      new AbstractList<String>() {
        @Override
        public int size() {
          return list.size();
        }

        @Override
        public String get(int index) {
          if (index < 2) {
            throw new AssertionError();
          }
          return list.get(index);
        }
      };

  EvictingQueue<String> queue = EvictingQueue.create(3);
  assertTrue(queue.addAll(misbehavingList));

  assertEquals("three", queue.remove());
  assertEquals("four", queue.remove());
  assertEquals("five", queue.remove());
  assertTrue(queue.isEmpty());
}
项目:andbg    文件:ReflectionConstructor.java   
@Nonnull @Override public List<? extends MethodParameter> getParameters() {
    final Constructor method = this.constructor;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                @Nonnull @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                @Nullable @Override public String getName() {
                    return null;
                }

                @Nonnull @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
项目:andbg    文件:ReflectionMethod.java   
@Nonnull @Override public List<? extends MethodParameter> getParameters() {
    final java.lang.reflect.Method method = this.method;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                @Nonnull @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                @Nullable @Override public String getName() {
                    return null;
                }

                @Nonnull @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
项目:RNLearn_Project1    文件:Arguments.java   
/**
 * This overload is like the above, but uses reflection to operate on any
 * primitive or object type.
 */
public static <T> WritableNativeArray makeNativeArray(final Object objects) {
  if (objects == null) {
    return new WritableNativeArray();
  }
  // No explicit check for objects's type here.  If it's not an array, the
  // Array methods will throw IllegalArgumentException.
  return makeNativeArray(new AbstractList() {
      public int size() {
        return Array.getLength(objects);
      }
      public Object get(int index) {
        return Array.get(objects, index);
      }
    });
}
项目:RNLearn_Project1    文件:Arguments.java   
/**
 * This overload is like the above, but uses reflection to operate on any
 * primitive or object type.
 */
public static <T> WritableNativeArray makeNativeArray(final Object objects) {
  if (objects == null) {
    return new WritableNativeArray();
  }
  // No explicit check for objects's type here.  If it's not an array, the
  // Array methods will throw IllegalArgumentException.
  return makeNativeArray(new AbstractList() {
      public int size() {
        return Array.getLength(objects);
      }
      public Object get(int index) {
        return Array.get(objects, index);
      }
    });
}
项目:openjdk9    文件:ClassInfoImpl.java   
/**
 * Report errors for unused propOrder entries.
 */
public void checkUnusedProperties() {
    for( int i=0; i<used.length; i++ )
        if(used[i]==null) {
            String unusedName = propOrder[i];
            String nearest = EditDistance.findNearest(unusedName, new AbstractList<String>() {
                public String get(int index) {
                    return properties.get(index).getName();
                }

                public int size() {
                    return properties.size();
                }
            });
            boolean isOverriding = (i > (properties.size()-1)) ? false : properties.get(i).hasAnnotation(OverrideAnnotationOf.class);
            if (!isOverriding) {
                builder.reportError(new IllegalAnnotationException(
                Messages.PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY.format(unusedName,nearest),ClassInfoImpl.this));
            }
        }
}
项目:ThriftyPaxos    文件:MVMap.java   
/**
 * Get the key list. The list is a read-only representation of all keys.
 * <p>
 * The get and indexOf methods are O(log(size)) operations. The result of
 * indexOf is cast to an int.
 *
 * @return the key list
 */
public List<K> keyList() {
    return new AbstractList<K>() {

        @Override
        public K get(int index) {
            return getKey(index);
        }

        @Override
        public int size() {
            return MVMap.this.size();
        }

        @Override
        @SuppressWarnings("unchecked")
        public int indexOf(Object key) {
            return (int) getKeyIndex((K) key);
        }

    };
}
项目:balloonist    文件:MysteryContainer.java   
/**
 * @return a live List of selected model items.
 */
public List selectedModelItems()
{
    return new AbstractList()
    {
        public Object get(int index)
        {
            MysteryComponent component = (MysteryComponent) selectedMysteryComponents.get(index);
            return component.getModel();
        }

        public int size()
        {
            return selectedMysteryComponents.size();
        }
    };
}
项目:xtext-extras    文件:JvmModelGeneratorTest.java   
@Test
public void testExtends() {
  try {
    final XExpression expression = this.expression("null", false);
    final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
      it.setAbstract(true);
      EList<JvmTypeReference> _superTypes = it.getSuperTypes();
      JvmTypeReference _typeRef = this.typeRef(expression, AbstractList.class, String.class);
      this.builder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
    };
    final JvmGenericType clazz = this.builder.toClass(expression, "my.test.Foo", _function);
    final Class<?> compiled = this.compile(expression.eResource(), clazz);
    Assert.assertTrue(Iterable.class.isAssignableFrom(compiled));
    Assert.assertTrue(AbstractList.class.isAssignableFrom(compiled));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:ghostwriter    文件:AnonymousClassTest.java   
@Test
public void testAnonymousClass() {
    List<String> list = new AbstractList<String>() {

        @Override
        public int size() {
            return 0;
        }

        @Override
        public String get(int i) {
            return null;
        }

    };

    // we call clear here to drop the messages generated by the test method itself
    InMemoryTracerProvider.INSTANCE.getTracer().clearMessages();
    list.size();

    MessageSequenceAsserter.messageSequence()
            .entering("size")
            .returning("size", 0)
            .exiting("size");
}
项目:zjdroid    文件:ReflectionConstructor.java   
@Nonnull @Override public List<? extends MethodParameter> getParameters() {
    final Constructor method = this.constructor;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                @Nonnull @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                @Nullable @Override public String getName() {
                    return null;
                }

                @Nonnull @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
项目:zjdroid    文件:ReflectionMethod.java   
@Nonnull @Override public List<? extends MethodParameter> getParameters() {
    final java.lang.reflect.Method method = this.method;
    return new AbstractList<MethodParameter>() {
        private final Class[] parameters = method.getParameterTypes();

        @Override public MethodParameter get(final int index) {
            return new BaseMethodParameter() {
                @Nonnull @Override public Set<? extends Annotation> getAnnotations() {
                    return ImmutableSet.of();
                }

                @Nullable @Override public String getName() {
                    return null;
                }

                @Nonnull @Override public String getType() {
                    return ReflectionUtils.javaToDexName(parameters[index].getName());
                }
            };
        }

        @Override public int size() {
            return parameters.length;
        }
    };
}
项目:Skript    文件:UtilsTest.java   
@Test
@SuppressWarnings("null")
public void testSuperClass() {

    final Class<?>[][] classes = {
            {Object.class, Object.class},
            {String.class, String.class},
            {String.class, Object.class, Object.class},
            {Object.class, String.class, Object.class},
            {String.class, String.class, String.class},
            {Object.class, String.class, Object.class, String.class, Object.class},
            {Double.class, Integer.class, Number.class},
            {UnknownHostException.class, FileNotFoundException.class, IOException.class},
            {SortedMap.class, TreeMap.class, SortedMap.class},
            {LinkedList.class, ArrayList.class, AbstractList.class},
            {List.class, Set.class, Collection.class},
            {ArrayList.class, Set.class, Collection.class},
    };

    for (final Class<?>[] cs : classes) {
        assertEquals(cs[cs.length - 1], Utils.getSuperType(Arrays.copyOf(cs, cs.length - 1)));
    }

}
项目:toolbelt    文件:Joiner.java   
private static Iterable<Object> iterable(
    final Object first, final Object second, final Object[] rest) {
  checkNotNull(rest);
  return new AbstractList<Object>() {
    @Override
    public int size() {
      return rest.length + 2;
    }

    @Override
    public Object get(int index) {
      switch (index) {
        case 0:
          return first;
        case 1:
          return second;
        default:
          return rest[index - 2];
      }
    }
  };
}
项目:Ironman    文件:Arguments.java   
/**
 * This overload is like the above, but uses reflection to operate on any
 * primitive or object type.
 */
public static <T> WritableNativeArray makeNativeArray(final Object objects) {
  if (objects == null) {
    return new WritableNativeArray();
  }
  // No explicit check for objects's type here.  If it's not an array, the
  // Array methods will throw IllegalArgumentException.
  return makeNativeArray(new AbstractList() {
      public int size() {
        return Array.getLength(objects);
      }
      public Object get(int index) {
        return Array.get(objects, index);
      }
    });
}
项目:dwg-lib    文件:Insert.java   
public List<CadObject> getOwnedObjects()
{
    return new AbstractList<CadObject>() {

        @Override
        public CadObject get(int index)
        {
            CadObject result = objectMap.parseObject(ownedObjectHandles[index]);
            return result;
        }

        @Override
        public int size()
        {
            return ownedObjectHandles.length;
        }
    };
}
项目:dwg-lib    文件:Layout.java   
public List<CadObject> getViewPorts()
{
    return new AbstractList<CadObject>() {

        @Override
        public CadObject get(int index)
        {
            CadObject result = objectMap.parseObject(viewportHandles[index]);
            if (!(result instanceof VPort || result instanceof ViewPort)) {
                throw new RuntimeException("unexpected object class");
            }
            return (CadObject) result;
        }

        @Override
        public int size()
        {
            return viewportHandles.length;
        }
    };
}
项目:dwg-lib    文件:LTypeControlObj.java   
public List<LType> getLineTypes() {
    return new AbstractList<LType>() {

        @Override
        public LType get(int index)
        {
            return (LType)objectMap.parseObjectPossiblyNull(lineTypeHandles[index]);
        }

        @Override
        public int size()
        {
            return lineTypeHandles.length;
        }
    };
}