Example usage for java.util Collections copy

List of usage examples for java.util Collections copy

Introduction

In this page you can find the example usage for java.util Collections copy.

Prototype

public static <T> void copy(List<? super T> dest, List<? extends T> src) 

Source Link

Document

Copies all of the elements from one list into another.

Usage

From source file:Main.java

public static List union(List srcList, List destList) {
    List list = new ArrayList<>(Arrays.asList(new Object[srcList.size()]));
    Collections.copy(list, srcList);
    list.addAll(destList);//from ww w  .ja  va  2  s  .c o m
    return list;
}

From source file:Main.java

public static List intersect(List srcList, List destList) {
    List list = new ArrayList<>(Arrays.asList(new Object[srcList.size()]));
    Collections.copy(list, srcList);
    list.retainAll(destList);// ww  w .j  ava2  s. c o m
    return list;
}

From source file:Main.java

public static List substract(List srcList, List destList) {
    List list = new ArrayList<>(Arrays.asList(new Object[srcList.size()]));
    Collections.copy(list, srcList);
    list.removeAll(destList);//  w w  w .j  av  a  2s  .  co  m
    return list;
}

From source file:Main.java

public static <T extends Object> void copy(final List<? super T> list0, final List<? extends T> list1) {
    Collections.copy(list0, list1);
}

From source file:org.axe.util.CollectionUtil.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> List<T> intersect(List ls, List ls2) {
    List<T> list = new ArrayList(Arrays.asList(new Object[ls.size()]));
    Collections.copy(list, ls);
    list.retainAll(ls2);/* w  w w.  j  a  v  a  2s.  com*/
    return list;
}

From source file:edu.bu.kuali.kra.award.sapintegration.ValidationError.java

public ValidationError(String errorKey, List<String> errorParams) {
    if (StringUtils.isBlank(errorKey)) {
        throw new IllegalArgumentException("The error key must be non-null.");
    }//  ww w.  ja  va2  s.  c  o m
    this.errorKey = errorKey;
    this.errorParams = new ArrayList<String>(errorParams);
    if (errorParams != null) {
        Collections.copy(this.errorParams, errorParams);
    }
}

From source file:org.axe.util.CollectionUtil.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> List<T> union(List ls, List ls2) {
    List list = new ArrayList(Arrays.asList(new Object[ls.size()]));
    Collections.copy(list, ls);
    list.addAll(ls2);//from  w ww .j  a  va2  s  .  c  o m
    return list;
}

From source file:org.axe.util.CollectionUtil.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> List<T> diff(List ls, List ls2) {
    List list = new ArrayList(Arrays.asList(new Object[ls.size()]));
    Collections.copy(list, ls);
    list.removeAll(ls2);//w w  w  .j a v  a 2 s .c  o m
    return list;
}

From source file:de.tor.tribes.util.algo.types.TimeFrame.java

public TimeFrame(Date pStartNotBefore, Date pArriveNotBefore, Date pStartNotAfter, Date pArriveNotAfter,
        List<TimeSpan> pSendTimeSpans, List<TimeSpan> pArriveTimeSpans) {
    startNotBefore = pStartNotBefore.getTime();
    startNotAfter = pStartNotAfter.getTime();
    arriveNotBefore = pArriveNotBefore.getTime();
    arriveNotAfter = pArriveNotAfter.getTime();
    sendTimeSpans = new LinkedList<>();
    arriveTimeSpans = new LinkedList<>();
    if (pSendTimeSpans != null) {
        Collections.copy(sendTimeSpans, pSendTimeSpans);
    }/*from w  w w .j av  a 2  s  .c om*/
    if (pArriveTimeSpans != null) {
        Collections.copy(arriveTimeSpans, pArriveTimeSpans);
    }
}

From source file:com.eviware.soapui.impl.wsdl.support.wss.IncomingWss.java

public Vector<Object> processIncoming(Document soapDocument, PropertyExpansionContext context)
        throws WSSecurityException {
    Element header = WSSecurityUtil.findWsseSecurityHeaderBlock(soapDocument, soapDocument.getDocumentElement(),
            false);/*from  w  w  w . j ava2 s  .  co m*/
    if (header == null)
        return null;

    try {
        WSSecurityEngine wssecurityEngine = new WSSecurityEngine();
        WssCrypto signatureCrypto = getWssContainer().getCryptoByName(getSignatureCrypto());
        WssCrypto decryptCrypto = getWssContainer().getCryptoByName(getDecryptCrypto());
        Crypto sig = signatureCrypto == null ? null : signatureCrypto.getCrypto();
        Crypto dec = decryptCrypto == null ? null : decryptCrypto.getCrypto();

        if (sig == null && dec == null)
            throw new WSSecurityException("Missing cryptos");

        if (sig == null)
            sig = dec;
        else if (dec == null)
            dec = sig;

        List<WSSecurityEngineResult> incomingResult = wssecurityEngine.processSecurityHeader(soapDocument,
                (String) null, new WSSCallbackHandler(dec), sig, dec);

        Vector<Object> wssResult = new Vector<Object>();
        wssResult.setSize(incomingResult.size());
        Collections.copy(wssResult, incomingResult);
        return wssResult;

    } catch (WSSecurityException e) {
        SoapUI.logError(e);
        throw e;
    }
}