Example usage for com.google.common.collect ListMultimap removeAll

List of usage examples for com.google.common.collect ListMultimap removeAll

Introduction

In this page you can find the example usage for com.google.common.collect ListMultimap removeAll.

Prototype

@Override
List<V> removeAll(@Nullable Object key);

Source Link

Document

Because the values for a given key may have duplicates and follow the insertion ordering, this method returns a List , instead of the java.util.Collection specified in the Multimap interface.

Usage

From source file:org.dishevelled.bio.variant.vcf.header.VcfSampleHeaderLine.java

/**
 * Parse the specified value into a VCF SAMPLE header line.
 *
 * @param value value, must not be null//from w ww  . j a  v a  2s.com
 * @return the specified value parsed into a VCF SAMPLE header line
 */
public static VcfSampleHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##SAMPLE="));
    ListMultimap<String, String> entries = parseEntries(value.replace("##SAMPLE=", ""));

    String id = requiredString("ID", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");

    return new VcfSampleHeaderLine(id, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfFilterHeaderLine.java

/**
 * Parse the specified value into a VCF FILTER header line.
 *
 * @param value value, must not be null//from ww w .ja  v  a  2s. c o  m
 * @return the specified value parsed into a VCF FILTER header line
 */
public static VcfFilterHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##FILTER="));
    ListMultimap<String, String> entries = VcfHeaderLineParser.parseEntries(value.replace("##FILTER=", ""));

    String id = VcfHeaderLineParser.requiredString("ID", entries);
    String description = VcfHeaderLineParser.requiredString("Description", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");
    attributes.removeAll("Description");

    return new VcfFilterHeaderLine(id, description, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfAltHeaderLine.java

/**
 * Parse the specified value into a VCF ALT header line.
 *
 * @param value value, must not be null//from   w w w .j a va 2s . c  om
 * @return the specified value parsed into a VCF ALT header line
 */
public static VcfAltHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##ALT="));
    ListMultimap<String, String> entries = VcfHeaderLineParser.parseEntries(value.replace("##ALT=", ""));

    String id = VcfHeaderLineParser.requiredString("ID", entries);
    String description = VcfHeaderLineParser.requiredString("Description", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");
    attributes.removeAll("Description");

    return new VcfAltHeaderLine(id, description, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfStructuredHeaderLine.java

/**
 * Parse the specified value into a structured VCF header line.
 *
 * @param value value, must not be null/*w  w w .  j  a va  2s . c om*/
 * @return the specified value parsed into a structured VCF header line
 */
public static VcfStructuredHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(isStructured(value));
    String name = value.substring(2, value.indexOf("="));
    ListMultimap<String, String> entries = parseEntries(value.replace("##" + name + "=", ""));

    String id = requiredString("ID", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");

    return new VcfStructuredHeaderLine(name, id, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfMetaHeaderLine.java

/**
 * Parse the specified value into a VCF META header line.
 *
 * @param value value, must not be null/*  www  .  j a va 2 s .  co m*/
 * @return the specified value parsed into a VCF META header line
 */
public static VcfMetaHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##META="));
    ListMultimap<String, String> entries = parseEntries(value.replace("##META=", ""));

    String id = requiredString("ID", entries);
    VcfHeaderLineNumber number = optionalNumber("Number", entries);
    VcfHeaderLineType type = optionalType("Type", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");
    attributes.removeAll("Number");
    attributes.removeAll("Type");

    return new VcfMetaHeaderLine(id, number, type, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfFormatHeaderLine.java

/**
 * Parse the specified value into a VCF FORMAT header line.
 *
 * @param value value, must not be null/*  www  .j a va2s .co  m*/
 * @return the specified value parsed into a VCF FORMAT header line
 */
public static VcfFormatHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##FORMAT="));
    ListMultimap<String, String> entries = VcfHeaderLineParser.parseEntries(value.replace("##FORMAT=", ""));

    String id = VcfHeaderLineParser.requiredString("ID", entries);
    VcfHeaderLineNumber number = VcfHeaderLineParser.requiredNumber("Number", entries);
    VcfHeaderLineType type = VcfHeaderLineParser.requiredType("Type", entries);
    String description = VcfHeaderLineParser.requiredString("Description", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");
    attributes.removeAll("Number");
    attributes.removeAll("Type");
    attributes.removeAll("Description");

    return new VcfFormatHeaderLine(id, number, type, description, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfContigHeaderLine.java

/**
 * Parse the specified value into a VCF contig header line.
 *
 * @param value value, must not be null/*from  ww w .  j av a  2  s.c  o m*/
 * @return the specified value parsed into a VCF contig header line
 */
public static VcfContigHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##contig="));
    ListMultimap<String, String> entries = VcfHeaderLineParser.parseEntries(value.replace("##contig=", ""));

    String id = VcfHeaderLineParser.requiredString("ID", entries);
    Long length = VcfHeaderLineParser.optionalLong("length", entries);
    String md5 = VcfHeaderLineParser.optionalString("MD5", entries);
    String url = VcfHeaderLineParser.optionalString("URL", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");
    attributes.removeAll("length");
    attributes.removeAll("MD5");
    attributes.removeAll("URL");

    return new VcfContigHeaderLine(id, length, md5, url, attributes);
}

From source file:org.dishevelled.bio.variant.vcf.header.VcfInfoHeaderLine.java

/**
 * Parse the specified value into a VCF INFO header line.
 *
 * @param value value, must not be null//from www  .  j  a  va2  s .  c o m
 * @return the specified value parsed into a VCF INFO header line
 */
public static VcfInfoHeaderLine valueOf(final String value) {
    checkNotNull(value);
    checkArgument(value.startsWith("##INFO="));
    ListMultimap<String, String> entries = parseEntries(value.replace("##INFO=", ""));

    String id = requiredString("ID", entries);
    VcfHeaderLineNumber number = requiredNumber("Number", entries);
    VcfHeaderLineType type = requiredType("Type", entries);
    String description = requiredString("Description", entries);
    String source = optionalString("Source", entries);
    String version = optionalString("Version", entries);

    ListMultimap<String, String> attributes = ArrayListMultimap.create(entries);
    attributes.removeAll("ID");
    attributes.removeAll("Number");
    attributes.removeAll("Type");
    attributes.removeAll("Description");
    attributes.removeAll("Source");
    attributes.removeAll("Version");

    return new VcfInfoHeaderLine(id, number, type, description, source, version, attributes);
}

From source file:com.opengamma.collect.io.PropertySet.java

/**
 * Combines this property set with another.
 * <p>//from   w  w  w  . j  a v a 2 s.c  om
 * The specified property set takes precedence.
 * 
 * @param other  the other property set
 * @return the combined property set
 */
public PropertySet combinedWith(PropertySet other) {
    ArgChecker.notNull(other, "other");
    if (other.isEmpty()) {
        return this;
    }
    if (isEmpty()) {
        return other;
    }
    ListMultimap<String, String> map = ArrayListMultimap.create(keyValueMap);
    for (String key : other.asMap().keySet()) {
        map.removeAll(key);
        map.putAll(key, other.getValueList(key));
    }
    return new PropertySet(ImmutableListMultimap.copyOf(map));
}

From source file:com.opengamma.strata.collect.io.PropertySet.java

/**
 * Combines this property set with another.
 * <p>//  w w w. j av  a 2s. co m
 * The specified property set takes precedence.
 * 
 * @param other  the other property set
 * @return the combined property set
 */
public PropertySet combinedWith(PropertySet other) {
    ArgChecker.notNull(other, "other");
    if (other.isEmpty()) {
        return this;
    }
    if (isEmpty()) {
        return other;
    }
    ListMultimap<String, String> map = ArrayListMultimap.create(keyValueMap);
    for (String key : other.asMultimap().keySet()) {
        map.removeAll(key);
        map.putAll(key, other.valueList(key));
    }
    return new PropertySet(ImmutableListMultimap.copyOf(map));
}