List add - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for List add method.

This code example shows how to use the following methods:
        documentBuilderFactory.setNamespaceAware(true);
        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
        document = documentBuilder.parse(file);
        document.getDocumentElement().normalize();
        List<Source> body = new ArrayList<Source>();
        body.add(new DOMSource(document.getDocumentElement()));
        payload = new CxfPayload<String[]>(new ArrayList<String[]>(), body, null);
        emptyPayload = new CxfPayload<String[]>(new ArrayList<String[]>(), new ArrayList<Source>(), null);
        inputStream = new FileInputStream(file);
    } 
 
    @Test
    public void testDocumentToCxfPayload() { 
        CxfPayload<String[]> payload = CxfPayloadConverter.documentToCxfPayload(document, exchange);
        assertNotNull(payload);
        assertEquals("Get a wrong size of body", 1, payload.getBody().size());
    } 
 
    @Test
    public void testNodeListToCxfPayload() { 
10
CodeRank
This code example shows how to use the following methods:add, get, isEmpty, size
	 * the call to {@code afterTestClass()} throws an exception, it will also be tracked. 
	 * Multiple exceptions will be combined into a {@link MultipleFailureException}. 
	 */ 
	@Override 
	public void evaluate() throws Throwable {
		List<Throwable> errors = new ArrayList<Throwable>();
		try { 
			this.next.evaluate();
		} 
		catch (Throwable e) {
			errors.add(e);
		} 
 
		try { 
			this.testContextManager.afterTestClass();
		} 
		catch (Exception e) {
			errors.add(e);
		} 
 

9
CodeRank
This code example shows how to use the following methods:put
        result.putExtra("com.jakewharton.android.viewpagerindicator.sample.Path", path);
        return result;
    } 
 
    protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
        Map<String, Object> temp = new HashMap<String, Object>();
        temp.put("title", name);
        temp.put("intent", intent);
        data.add(temp);
    } 
 
    @Override 
    @SuppressWarnings("unchecked") 
    protected void onListItemClick(ListView l, View v, int position, long id) {
        Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
 
        Intent intent = (Intent) map.get("intent");
        startActivity(intent);
    } 
} 
9
CodeRank
This code example shows how to use the following methods:add
	public void setUp() { 
		kh = new GeneratedKeyHolder();
	} 
 
	public void testSingleKey(){ 
		List<Map<String, Object>> l = new LinkedList<Map<String, Object>>();
		Map<String, Object> m = new HashMap<String, Object>(1);
		m.put("key", 1); 
		l.add(m); 
		kh.getKeyList().addAll(l);
		assertEquals("single key should be returned", 1, kh.getKey().intValue());
	} 
 
	public void testSingleKeyNonNumeric(){ 
		List<Map<String, Object>> l = new LinkedList<Map<String, Object>>();
		Map<String, Object> m = new HashMap<String, Object>(1);
		m.put("key", "1"); 
		l.add(m); 
		kh.getKeyList().addAll(l);
		try { 
9
CodeRank
This code example shows how to use the following methods:toString, add
public class OffsetCompareProberTest { 
 
	@Test
	public void testFindAlertList(){ 
		OffsetCompareProber ocp = new OffsetCompareProber(null);
		List<String> alertList = new LinkedList<String>();
		alertList.add("defaultWW");
		 
		List<String> wwList = new LinkedList<String>();
		wwList.add("defaultWW");
		wwList.add("groupWW");
		 
		List<String> topicList = new LinkedList<String>();
		topicList.add("groupTopic");
		 
		List<String> ignoreTopicList = new LinkedList<String>();
		ignoreTopicList.add("groupTopicIgnore");
		 
		Group group = new Group();
		group.setGroup("group1");

9
CodeRank
This code example shows how to use the following methods:add, get, isEmpty, size
	 * {@link MultipleFailureException}. 
	 */ 
	@Override 
	public void evaluate() throws Throwable {
		Throwable testException = null;
		List<Throwable> errors = new ArrayList<Throwable>();
		try { 
			this.next.evaluate();
		} 
		catch (Throwable e) {
			testException = e;
			errors.add(e);
		} 
 
		try { 
			this.testContextManager.afterTestMethod(this.testInstance, this.testMethod, testException);
		} 
		catch (Exception e) {
			errors.add(e);
		} 

9
CodeRank
This code example shows how to use the following methods:add
    private static List<String> mimeTypes;
    private static List<String> extensions;
 
    static { 
        names = new ArrayList<String>(5);
        names.add("ECMAScript");
        names.add("ecmascript");
        names.add("JavaScript");
        names.add("javascript");
        names.add("js");
        names = Collections.unmodifiableList(names);
 
        mimeTypes = new ArrayList<String>(4);
        mimeTypes.add("application/ecmascript");
        mimeTypes.add("text/ecmascript");
        mimeTypes.add("application/javascript");
        mimeTypes.add("text/javascript");
        mimeTypes = Collections.unmodifiableList(mimeTypes);
 
        extensions = new ArrayList<String>(2);
9
CodeRank
This code example shows how to use the following methods:add
    public DocumentMapper.MergeFlags mergeFlags() { 
        return mergeFlags;
    } 
 
    public void addConflict(String mergeFailure) {
        mergeConflicts.add(mergeFailure);
    } 
 
    public boolean hasConflicts() { 
        return !mergeConflicts.isEmpty();
    } 
 
    public String[] buildConflicts() {
        return mergeConflicts.toArray(new String[mergeConflicts.size()]);
    } 
} 
8
CodeRank
This code example shows how to use the following methods:toString, add
public class OffsetCompareProberTest { 
 
	@Test 
	public void testFindAlertList(){ 
		OffsetCompareProber ocp = new OffsetCompareProber(null);
		List<String> alertList = new LinkedList<String>();
		alertList.add("defaultWW");
		 
		List<String> wwList = new LinkedList<String>();
		wwList.add("defaultWW");
		wwList.add("groupWW");
		 
		List<String> topicList = new LinkedList<String>();
		topicList.add("groupTopic");
		 
		List<String> ignoreTopicList = new LinkedList<String>();
		ignoreTopicList.add("groupTopicIgnore");
		 
		Group group = new Group();
		group.setGroup("group1");

8
CodeRank
This code example shows how to use the following methods:add
    private DruidDataSource dataSource;
 
    protected void setUp() throws Exception { 
        dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mock:xxx");
        List<Object> sqlList = new ArrayList<Object>();
        sqlList.add("select 123");
        sqlList.add(null);
        sqlList.add("");
 
        dataSource.setConnectionInitSqls(sqlList);
    } 
 
    protected void tearDown() throws Exception { 
        dataSource.close();
    } 
 
    public void testDefault() throws Exception { 
        Connection conn = dataSource.getConnection();
 
8
CodeRank

Related List add Questions & Answers:

Other List add Examples

99:					site.setDescription(cursor.getString(4));
100:					// Adding contact to list
101:					siteList.add(site);
102:				} while (cursor.moveToNext());
103:			}

Read More

145:				}
146:	
147:				return null;
148:			}
149:

Read More

22:				// Preparing post params
23:				List<NameValuePair> params = new ArrayList<NameValuePair>();
24:				params.add(new BasicNameValuePair("name", newCategory));
25:	
26:				ServiceHandler serviceClient = new ServiceHandler();

Read More

add Method Overview
Appends the specified element to the end of this list (optional operation).
See Code Examples for other Java 8 List Methods: