Java Code Examples for java.util.AbstractList#add()
The following examples show how to use
java.util.AbstractList#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionManagerTest.java From netbeans with Apache License 2.0 | 6 votes |
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); }
Example 2
Source File: AbstractSectionParm.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * Group names to array. * * @param names the names * @return the string[] */ protected String[] groupNamesToArray(String names) { if (names.equals(NOT_IN_ANY_GROUP)) return new String[] { names }; AbstractList items = new ArrayList(); int start = 0; int end; while (start < names.length() && (names.charAt(start) == ' ')) start++; for (; start < names.length();) { end = names.indexOf(' ', start); if (end == -1) { items.add(names.substring(start)); break; } items.add(names.substring(start, end)); start = end; while (start < names.length() && names.charAt(start) == ' ') start++; } return (String[]) items.toArray(stringArray0); }
Example 3
Source File: TestHiveUtil.java From presto with Apache License 2.0 | 5 votes |
private static void assertToPartitionValues(String partitionName) throws MetaException { List<String> actual = toPartitionValues(partitionName); AbstractList<String> expected = new ArrayList<>(); for (String s : actual) { expected.add(null); } Warehouse.makeValsFromName(partitionName, expected); assertEquals(actual, expected); }
Example 4
Source File: AbstractListTest.java From j2objc with Apache License 2.0 | 5 votes |
public void test_indexOfLjava_lang_Object() { AbstractList al = new ArrayList(); al.add(0); al.add(1); al.add(2); al.add(3); al.add(4); assertEquals(-1, al.indexOf(5)); assertEquals(2, al.indexOf(2)); }
Example 5
Source File: AbstractListTest.java From j2objc with Apache License 2.0 | 5 votes |
public void test_lastIndexOfLjava_lang_Object() { AbstractList al = new ArrayList(); al.add(0); al.add(1); al.add(2); al.add(2); al.add(2); al.add(2); al.add(2); al.add(3); al.add(4); assertEquals(-1, al.lastIndexOf(5)); assertEquals(6, al.lastIndexOf(2)); }
Example 6
Source File: AbstractListTest.java From j2objc with Apache License 2.0 | 5 votes |
public void test_indexOf_Ljava_lang_Object() { AbstractList<Integer> list = new MockArrayList<Integer>(); Integer[] array = { 1, 2, 3, 4, 5 }; list.addAll(Arrays.asList(array)); assertEquals("find 0 in the list do not contain 0", -1, list .indexOf(new Integer(0))); assertEquals("did not return the right location of element 3", 2, list .indexOf(new Integer(3))); assertEquals("find null in the list do not contain null element", -1, list.indexOf(null)); list.add(null); assertEquals("did not return the right location of element null", 5, list.indexOf(null)); }
Example 7
Source File: AbstractListTest.java From j2objc with Apache License 2.0 | 5 votes |
public void test_lastIndexOf_Ljava_lang_Object() { AbstractList<Integer> list = new MockArrayList<Integer>(); Integer[] array = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 }; list.addAll(Arrays.asList(array)); assertEquals("find 6 in the list do not contain 6", -1, list .lastIndexOf(new Integer(6))); assertEquals("did not return the right location of element 4", 6, list .lastIndexOf(new Integer(4))); assertEquals("find null in the list do not contain null element", -1, list.lastIndexOf(null)); list.add(null); assertEquals("did not return the right location of element null", 10, list.lastIndexOf(null)); }
Example 8
Source File: AbstractSectionParm.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * get set of settings group from settingsTree that correspond to parmsection group. * * @param group the group * @return set of settings group from settingsTree that correspond to parm-section group */ protected TreeItem[] getSettingsGroups(TreeItem group) { if (null == settingsTree) return null; if (isNOT_IN_ANY_GROUP(group)) return new TreeItem[] { settingsTree.getItems()[0] }; AbstractList results = new ArrayList(); String[] groupNamesArray = groupNamesToArray(getName(group.getText())); TreeItem[] items = settingsTree.getItems(); if (groupNamesArray.length == 1 && groupNamesArray[0].equals(COMMON_GROUP)) { // add parm to all groups except <Not in any group> TreeItem[] result = new TreeItem[items.length - 1]; System.arraycopy(items, 1, result, 0, result.length); return result; } for (int itemIndex = 0; itemIndex < items.length; itemIndex++) { String name = getName(items[itemIndex].getText()); for (int i = 0; i < groupNamesArray.length; i++) { if (name.equals(groupNamesArray[i])) results.add(items[itemIndex]); } } return (TreeItem[]) results.toArray(treeItemArray0); }