- Timestamp:
- 2013-12-07T14:47:47+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java
r6021 r6452 21 21 import org.openstreetmap.josm.gui.widgets.JosmTextField; 22 22 import org.openstreetmap.josm.tools.GBC; 23 import org.openstreetmap.josm.tools.Predicate; 24 import org.openstreetmap.josm.tools.Utils; 23 25 import org.openstreetmap.josm.tools.WindowGeometry; 24 26 … … 28 30 PrefEntry entry; 29 31 32 /** 33 * Constructs a new {@code ListEditor}. 34 */ 30 35 public ListEditor(final JComponent gui, PrefEntry entry, ListSetting setting) { 31 36 super(gui, tr("Change list setting"), new String[] {tr("OK"), tr("Cancel")}); … … 42 47 } 43 48 49 /** 50 * Returns the list of values. 51 * @return The list of values. 52 */ 44 53 public List<String> getData() { 45 return data; 54 return new ArrayList<String>(Utils.filter(data, new Predicate<String>() { 55 @Override 56 public boolean evaluate(String object) { 57 return object != null && !object.isEmpty(); 58 } 59 })); 46 60 } 47 61 … … 101 115 } 102 116 } 103 104 117 } -
trunk/src/org/openstreetmap/josm/tools/Predicate.java
r3177 r6452 2 2 package org.openstreetmap.josm.tools; 3 3 4 // Used to identify objects that fulfill a certain condition, e.g. when filtering a collection 4 /** 5 * Used to identify objects that fulfill a certain condition, e.g. when filtering a collection. 6 * 7 * @param <T> The objects type 8 * @since 3177 9 */ 5 10 public interface Predicate<T> { 6 // @return whether the object passes the test or not 11 12 /** 13 * Determines whether the object passes the test or not 14 * @param object The object to evaluate 15 * @return {@code true} if the object passes the test, {@code false} otherwise 16 */ 7 17 public boolean evaluate(T object); 8 18 }
Note:
See TracChangeset
for help on using the changeset viewer.