Example usage for java.util List remove

List of usage examples for java.util List remove

Introduction

In this page you can find the example usage for java.util List remove.

Prototype

E remove(int index);

Source Link

Document

Removes the element at the specified position in this list (optional operation).

Usage

From source file:$.Collections3.java

/**
     * a-bList./*w  w  w . j a va 2 s. c  om*/
     */
    public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) {
        List<T> list = new ArrayList<T>(a);
        for (T element : b) {
            list.remove(element);
        }

        return list;
    }

From source file:Main.java

public static Intent createTakePictureIntent(@NonNull Context context, @NonNull Uri outputFileUri) {
    List<Intent> cameraIntents = createTakePictureIntentList(context, outputFileUri);

    if (cameraIntents.isEmpty())
        return null;

    Intent chooserIntent = new Intent(cameraIntents.get(0));

    cameraIntents.remove(0);

    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
            cameraIntents.toArray(new Parcelable[cameraIntents.size()]));

    return chooserIntent;
}

From source file:tsapalos.bill.play4share.UrlUtils.java

public static List<String> getSecondaryVideos(List<String> videosUrls) {
    videosUrls.remove(0);
    return videosUrls;
}

From source file:com.cnksi.core.tools.utils.Collections3.java

/**
 * a-bList./*from w  w  w .j  a v  a  2s .co  m*/
 */
public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) {

    List<T> list = new ArrayList<T>(a);
    for (T element : b) {
        list.remove(element);
    }

    return list;
}

From source file:com.mirth.connect.connectors.dimse.DICOMConfigurationUtil.java

public static void configureDcmRcv(MirthDcmRcv dcmrcv, DICOMReceiver connector,
        DICOMReceiverProperties connectorProperties, String[] protocols) throws Exception {
    if (!StringUtils.equals(connectorProperties.getTls(), "notls")) {
        if (connectorProperties.getTls().equals("without")) {
            dcmrcv.setTlsWithoutEncyrption();
        } else if (connectorProperties.getTls().equals("3des")) {
            dcmrcv.setTls3DES_EDE_CBC();
        } else if (connectorProperties.getTls().equals("aes")) {
            dcmrcv.setTlsAES_128_CBC();/*from  ww w.j  a v a  2  s  .  c o  m*/
        }

        String trustStore = connector.getReplacer().replaceValues(connectorProperties.getTrustStore(),
                connector.getChannelId(), connector.getChannel().getName());
        if (StringUtils.isNotBlank(trustStore)) {
            dcmrcv.setTrustStoreURL(trustStore);
        }

        String trustStorePW = connector.getReplacer().replaceValues(connectorProperties.getTrustStorePW(),
                connector.getChannelId(), connector.getChannel().getName());
        if (StringUtils.isNotBlank(trustStorePW)) {
            dcmrcv.setTrustStorePassword(trustStorePW);
        }

        String keyPW = connector.getReplacer().replaceValues(connectorProperties.getKeyPW(),
                connector.getChannelId(), connector.getChannel().getName());
        if (StringUtils.isNotBlank(keyPW)) {
            dcmrcv.setKeyPassword(keyPW);
        }

        String keyStore = connector.getReplacer().replaceValues(connectorProperties.getKeyStore(),
                connector.getChannelId(), connector.getChannel().getName());
        if (StringUtils.isNotBlank(keyStore)) {
            dcmrcv.setKeyStoreURL(keyStore);
        }

        String keyStorePW = connector.getReplacer().replaceValues(connectorProperties.getKeyStorePW(),
                connector.getChannelId(), connector.getChannel().getName());
        if (StringUtils.isNotBlank(keyStorePW)) {
            dcmrcv.setKeyStorePassword(keyStorePW);
        }

        dcmrcv.setTlsNeedClientAuth(connectorProperties.isNoClientAuth());

        protocols = ArrayUtils.clone(protocols);

        if (connectorProperties.isNossl2()) {
            if (ArrayUtils.contains(protocols, "SSLv2Hello")) {
                List<String> protocolsList = new ArrayList<String>(Arrays.asList(protocols));
                protocolsList.remove("SSLv2Hello");
                protocols = protocolsList.toArray(new String[protocolsList.size()]);
            }
        } else if (!ArrayUtils.contains(protocols, "SSLv2Hello")) {
            List<String> protocolsList = new ArrayList<String>(Arrays.asList(protocols));
            protocolsList.add("SSLv2Hello");
            protocols = protocolsList.toArray(new String[protocolsList.size()]);
        }

        dcmrcv.setTlsProtocol(MirthSSLUtil.getEnabledHttpsProtocols(protocols));

        dcmrcv.initTLS();
    }
}

From source file:de.tudarmstadt.ukp.similarity.experiments.coling2012.util.ColingUtils.java

@SuppressWarnings("unchecked")
public static List<String> readGoldstandard(Dataset dataset) throws IOException {
    List<String> gold = new ArrayList<String>();

    if (dataset.equals(Dataset.MeterCorpus)) {
        List<String> originalLines = FileUtils.readLines(getGoldstandard(dataset));
        originalLines.remove(0); // remove header

        List<String> order = FileUtils
                .readLines(new File(UTILS_DIR + "/doc-order/" + dataset.toString() + ".txt"));

        // Process documents in the correct order
        for (String line : order) {
            String[] linesplit = line.split("\t");
            String docID = linesplit[0].substring(linesplit[0].indexOf("/newspapers/") + 1) + ".txt";

            // Look up document in the original gold standard file
            for (String origLine : originalLines) {
                String[] origLineSplit = origLine.split("\t");
                if (origLineSplit[0].equals(docID)) {
                    gold.add(origLineSplit[4]);
                    break;
                }// w  w w  .  j a va 2 s.  com
            }
        }
    } else if (dataset.equals(Dataset.WikipediaRewriteCorpus)) {
        List<String> originalLines = FileUtils.readLines(getGoldstandard(dataset));
        originalLines.remove(0); // remove header

        List<String> order = FileUtils
                .readLines(new File(UTILS_DIR + "/doc-order/" + dataset.toString() + ".txt"));

        // Process documents in the correct order
        for (String line : order) {
            String[] linesplit = line.split("\t");
            String docID = linesplit[0] + ".txt";

            // Look up document in the original gold standard file
            for (String origLine : originalLines) {
                String[] origLineSplit = origLine.split("\t");
                if (origLineSplit[0].equals(docID)) {
                    gold.add(origLineSplit[4]);
                    break;
                }
            }
        }
    } else if (dataset.equals(Dataset.WebisCrowdParaphraseCorpus)) {
        gold = FileUtils.readLines(getGoldstandard(dataset));
    }

    return gold;
}

From source file:com.emc.ecs.sync.service.SyncRecord.java

/**
 * passing no fields will update all fields except source_id
 *//*w  w w . j av a  2s.  co  m*/
public static String updateBySourceId(String tableName, String... fields) {
    String update = "update " + tableName + " set ";
    List<String> updateFields = new ArrayList<>(ALL_FIELDS);
    updateFields.remove(SOURCE_ID);
    if (fields != null && fields.length > 0)
        updateFields = Arrays.asList(fields);
    for (int i = 0; i < updateFields.size(); i++) {
        update += updateFields.get(i) + "=?";
        if (i < updateFields.size() - 1)
            update += ", ";
    }
    update += " where " + SOURCE_ID + " = ?";
    return update;
}

From source file:com.gargoylesoftware.js.CodeUpdater.java

private static void processFile(final File originalFile, final boolean isMain) throws IOException {
    String relativePath = originalFile.getPath().replace('\\', '/');
    relativePath = "com/gargoylesoftware/js/"
            + relativePath.substring(relativePath.indexOf("/jdk/") + "/jdk/".length());
    final String root = isMain ? "src/main/java/" : "src/test/java/";
    final File localFile = new File(root + relativePath);
    if (!localFile.exists()) {
        System.out.println("File doesn't locally exist: " + relativePath);
        return;//from  w  w  w. j  a va 2s.c  o  m
    }
    final List<String> originalLines = FileUtils.readLines(originalFile);
    final List<String> localLines = FileUtils.readLines(localFile);

    while (!isCodeStart(originalLines.get(0))) {
        originalLines.remove(0);
    }
    for (int i = 0; i < localLines.size(); i++) {
        if (isCodeStart(localLines.get(i))) {
            while (i < localLines.size()) {
                localLines.remove(i);
            }
            break;
        }
    }
    for (int i = 0; i < originalLines.size(); i++) {
        String line = originalLines.get(i);
        line = line.replace("jdk.internal.org.objectweb.asm", "org.objectweb.asm");
        line = line.replace("jdk.nashorn.internal", "com.gargoylesoftware.js.nashorn.internal");
        line = line.replace("jdk/nashorn/internal", "com/gargoylesoftware/js/nashorn/internal");
        line = line.replace("jdk/nashorn/javaadapters", "com/gargoylesoftware/js/nashorn/javaadapters");
        line = line.replace("jdk.nashorn.api", "com.gargoylesoftware.js.nashorn.api");
        line = line.replace("jdk.nashorn.tools", "com.gargoylesoftware.js.nashorn.tools");
        line = line.replace("jdk.internal.dynalink", "com.gargoylesoftware.js.internal.dynalink");
        line = line.replace("  @Constructor",
                "  @com.gargoylesoftware.js.nashorn.internal.objects.annotations.Constructor");
        line = line.replace("  @Property",
                "  @com.gargoylesoftware.js.nashorn.internal.objects.annotations.Property");
        originalLines.set(i, line);
        if (line.equals("@jdk.Exported")) {
            originalLines.remove(i--);
        }
    }
    localLines.addAll(originalLines);
    FileUtils.writeLines(localFile, localLines);
}

From source file:Main.java

public static byte[] getGrpprl(List<byte[]> sprmList, int size) {
    // spit out the final grpprl
    byte[] grpprl = new byte[size];
    int listSize = sprmList.size() - 1;
    int index = 0;
    for (; listSize >= 0; listSize--) {
        byte[] sprm = sprmList.remove(0);
        System.arraycopy(sprm, 0, grpprl, index, sprm.length);
        index += sprm.length;//from  w ww  .j a  v a2 s  .  c  o m
    }

    return grpprl;

}

From source file:Main.java

public static <T> int removeIf(final List<T> values, final Predicate<T> predicate) {
    int size = values.size();
    int total = 0;

    for (int i = 0; i < size;) {
        final T value = values.get(i);
        if (predicate.test(value)) {
            values.remove(i);
            total++;/*w w  w  . ja v  a 2s .  c om*/
            size--;
        } else {
            i++;
        }
    }

    return total;
}