Java List First Item cons(P first, List list)

Here you can find the source of cons(P first, List list)

Description

cons

License

Apache License

Declaration

public static <P> List<P> cons(P first, List<? extends P> list) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static <P> List<P> cons(P first, List<? extends P> list) {
        List<P> builder = new ArrayList<>(list.size() + 1);
        builder.add(first);//  w  ww.  j  a  va 2  s. c  o  m
        builder.addAll(list);
        return builder;
    }
}

Related

  1. addFirst(List list, Object values)
  2. addFirstAndRemoveOldIfNeed(List dest, List src)
  3. equalLists(List first, List second)
  4. expectedOrder(List src, Object first, Object second)
  5. extractFirst(int numberToExtract, List list)
  6. first(final List list)

  7. HOME | Copyright © www.java2s.com 2016