Example usage for org.apache.commons.collections15 EnumerationUtils toList

List of usage examples for org.apache.commons.collections15 EnumerationUtils toList

Introduction

In this page you can find the example usage for org.apache.commons.collections15 EnumerationUtils toList.

Prototype

public static <E> List<E> toList(Enumeration<E> enumeration) 

Source Link

Document

Creates a list based on an enumeration.

Usage

From source file:edu.northwestern.bioinformatics.studycalendar.osgi.felixcm.internal.PscFelixPersistenceManagerTest.java

private void assertDictionaryKeys(Dictionary<String, ?> actual, String... expectedKeys) {
    Collection<String> actualKeys = EnumerationUtils.toList(actual.keys());
    for (String expectedKey : expectedKeys) {
        assertTrue("Missing key " + expectedKey, actualKeys.contains(expectedKey));
    }/*from   ww  w . j  av  a2  s.c o  m*/
    assertEquals("Wrong number of keys", expectedKeys.length, actualKeys.size());
}

From source file:com.cburch.logisim.util.LocaleManager.java

public Iterable<String> getKeys() {
    return EnumerationUtils.toList(locale.getKeys());
}

From source file:edu.northwestern.bioinformatics.studycalendar.osgi.felixcm.internal.PscFelixPersistenceManager.java

@SuppressWarnings({ "unchecked" })
private void doStore(String pid, Dictionary values) {
    List<OsgiConfigurationProperty> existingProperties = getProperties(pid);
    Collection<String> newKeys = EnumerationUtils.toList(values.keys());
    Collection<String> existingKeys = new HashSet<String>();
    for (OsgiConfigurationProperty existingProperty : existingProperties) {
        String existingKey = existingProperty.getName();
        if (newKeys.contains(existingKey)) {
            existingProperty.setValue(values.get(existingKey));
            existingKeys.add(existingKey);
        } else {/*from  ww w .ja v a 2s . co  m*/
            getHibernateTemplate().delete(existingProperty);
        }
    }
    for (String newKey : newKeys) {
        if (!EXCLUDED_PROPERTIES.contains(newKey) && !existingKeys.contains(newKey)) {
            getHibernateTemplate().save(OsgiConfigurationProperty.create(pid, newKey, values.get(newKey)));
        }
    }
}