001    // License: GPL. For details, see LICENSE file.
002    package org.openstreetmap.josm.data.preferences;
003    
004    import java.util.Collection;
005    
006    import org.openstreetmap.josm.Main;
007    
008    /**
009     * A property containing a {@code Collection} of {@code String} as value.
010     */
011    public class CollectionProperty extends AbstractProperty<Collection<String>> {
012    
013        /**
014         * Constructs a new {@code CollectionProperty}.
015         * @param key The property key
016         * @param defaultValue The default value
017         */
018        public CollectionProperty(String key, Collection<String> defaultValue) {
019            super(key, defaultValue);
020        }
021    
022        @Override
023        public Collection<String> get() {
024            return Main.pref.getCollection(getKey(), getDefaultValue());
025        }
026    
027        @Override
028        public boolean put(Collection<String> value) {
029            return Main.pref.putCollection(getKey(), value);
030        }
031    }