Example usage for java.util EnumMap remove

List of usage examples for java.util EnumMap remove

Introduction

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

Prototype

public V remove(Object key) 

Source Link

Document

Removes the mapping for this key from this map if present.

Usage

From source file:Tutorial.java

public static void main(String[] args) {
    EnumMap<Tutorial, String> map = new EnumMap<Tutorial, String>(Tutorial.class);

    map.put(Tutorial.CSS, "1");
    map.put(Tutorial.Python, "2");
    map.put(Tutorial.PHP, "3");
    map.put(Tutorial.Java, "4");

    System.out.println(map);/*  w w  w. ja  v a  2 s .  co  m*/

    map.remove(Tutorial.PHP);

    System.out.println("Updated Map: " + map);
}

From source file:fr.avianey.androidsvgdrawable.QualifiedResource.java

public File getOutputFor(final Density density, final File to, final OutputType outputType) {
    StringBuilder builder = new StringBuilder(outputType.name());
    EnumMap<Type, String> qualifiers = new EnumMap<>(typedQualifiers);
    qualifiers.remove(Type.density);
    qualifiers.put(Type.density, density.name());
    builder.append(Qualifier.toQualifiedString(qualifiers));
    return new File(to, builder.toString());
}

From source file:com.espertech.esper.schedule.TestScheduleSpec.java

public void testValidate() {
    // Test all units missing
    EnumMap<ScheduleUnit, SortedSet<Integer>> unitValues = new EnumMap<ScheduleUnit, SortedSet<Integer>>(
            ScheduleUnit.class);
    assertInvalid(unitValues);/*from   w w w . ja  va 2 s .  c  om*/

    // Test one unit missing
    unitValues = (new ScheduleSpec()).getUnitValues();
    unitValues.remove(ScheduleUnit.HOURS);
    assertInvalid(unitValues);

    // Test all units are wildcards
    unitValues = (new ScheduleSpec()).getUnitValues();
    new ScheduleSpec(unitValues, null, null, null);

    // Test invalid value in month
    SortedSet<Integer> values = new TreeSet<Integer>();
    values.add(0);
    unitValues.put(ScheduleUnit.MONTHS, values);
    assertInvalid(unitValues);

    // Test valid value in month
    values = new TreeSet<Integer>();
    values.add(1);
    values.add(5);
    unitValues.put(ScheduleUnit.MONTHS, values);
    new ScheduleSpec(unitValues, null, null, null);
}