diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2018-10-16 06:11:39 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2018-10-16 06:11:39 -0300 |
| commit | d2be5b73d7a5653ad5c8273c17284346baa6f1c7 (patch) | |
| tree | 9d3c6adb193f53588bd5d004fdf80c0381685351 /base/src/main/java/bjc/utils/esodata/DefaultList.java | |
| parent | 0308029629a12711b849ea7765639b9b1f9e03d2 (diff) | |
| parent | d1d01769e7c55f7f62dc01cadf420d5f63424584 (diff) | |
Merge branch 'master' of github.com:bculkin2442/bjc-utils2
Diffstat (limited to 'base/src/main/java/bjc/utils/esodata/DefaultList.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/esodata/DefaultList.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/base/src/main/java/bjc/utils/esodata/DefaultList.java b/base/src/main/java/bjc/utils/esodata/DefaultList.java index 235a1a8..4d3d1dc 100644 --- a/base/src/main/java/bjc/utils/esodata/DefaultList.java +++ b/base/src/main/java/bjc/utils/esodata/DefaultList.java @@ -8,6 +8,8 @@ import java.util.List; * A list that has a default value that out-of-bounds accesses return. * * @author Ben Culkin + * @param <ValueType> + * The type of the values contained in the list. */ public class DefaultList<ValueType> extends AbstractList<ValueType> { /* @@ -20,33 +22,67 @@ public class DefaultList<ValueType> extends AbstractList<ValueType> { * bounds, but what are you going to do? */ - private ValueType defVal; private List<ValueType> backing; + /** + * Create a new DefaultList. + */ public DefaultList() { this(new ArrayList<>(), null); } + /** + * Create a new DefaultList, with a set default value. + * + * @param defVal + * The default value for the list. + */ public DefaultList(ValueType defVal) { this(new ArrayList<>(), defVal); } + /** + * Create a new DefaultList, with a specific backing list. + * + * @param backer + * The backing list to use. + * + */ public DefaultList(List<ValueType> backer) { this(backer, null); } + /** + * Create a new DefaultList, with a set default value. + * + * @param backer + * The backing list to use. + * + * @param defVal + * The default value for the list. + */ public DefaultList(List<ValueType> backer, ValueType defVal) { this.defVal = defVal; this.backing = backer; } + /** + * Get the default value. + * + * @return The default value. + */ public ValueType getDefault() { return defVal; } + /** + * Set the default value. + * + * @param defVal The default value. + */ public void setDefault(ValueType defVal) { this.defVal = defVal; } |
