Search in sources :

Example 1 with MultiReaderFastList

use of org.eclipse.collections.impl.list.mutable.MultiReaderFastList in project eclipse-collections by eclipse.

the class ListsTest method assertPresizedMultiReaderListEquals.

private static void assertPresizedMultiReaderListEquals(int initialCapacity, MultiReaderFastList<String> list) {
    try {
        Field delegateField = MultiReaderFastList.class.getDeclaredField("delegate");
        delegateField.setAccessible(true);
        FastList<String> delegate = (FastList<String>) delegateField.get(list);
        Field itemsField = FastList.class.getDeclaredField("items");
        itemsField.setAccessible(true);
        Object[] items = (Object[]) itemsField.get(delegate);
        Assert.assertEquals(initialCapacity, items.length);
    } catch (SecurityException | NoSuchFieldException | IllegalAccessException e) {
        throw new AssertionError(e);
    }
}
Also used : Field(java.lang.reflect.Field) FastList(org.eclipse.collections.impl.list.mutable.FastList) MultiReaderFastList(org.eclipse.collections.impl.list.mutable.MultiReaderFastList)

Aggregations

Field (java.lang.reflect.Field)1 FastList (org.eclipse.collections.impl.list.mutable.FastList)1 MultiReaderFastList (org.eclipse.collections.impl.list.mutable.MultiReaderFastList)1