diff --git a/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMap.java b/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMap.java index dc1a70c..927d219 100644 --- a/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMap.java +++ b/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMap.java @@ -23,15 +23,19 @@ public interface TableMap { * identifier * @param table * table + * @return an optional containing the previous value associated to the given + * key, or an empty optional if there was no association before */ - void put(String id, Table table); + Optional put(String id, Table table); /** - * Returns the table associated to the given identifier. + * Returns an optional containing the value associated to the given key, or + * an empty optional if there is no association. * * @param id * identifier - * @return the table associated to the given identifier + * @return an optional containing the value associated to the given key, or + * an empty optional if there is no association */ Optional
getTable(String id); diff --git a/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMapImpl.java b/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMapImpl.java index 01111fa..8dd4790 100644 --- a/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMapImpl.java +++ b/tabula-core/src/main/java/de/tudresden/inf/lat/tabula/table/TableMapImpl.java @@ -32,11 +32,6 @@ public TableMapImpl(TableMap otherTableMap) { otherTableMap.getTableIds().forEach(tableId -> put(tableId, otherTableMap.getTable(tableId).get())); } - /** - * Returns the identifiers of the stored tables. - * - * @return the identifiers of the stored tables - */ @Override public List getTableIds() { List ret = new ArrayList<>(); @@ -44,26 +39,11 @@ public List getTableIds() { return ret; } - /** - * Stores a table with the given identifier. - * - * @param id - * identifier - * @param table - * table - */ @Override - public void put(String id, Table table) { - this.map.putOpt(id, table); + public Optional
put(String id, Table table) { + return this.map.putOpt(id, table); } - /** - * Returns the table associated to the given identifier. - * - * @param id - * identifier - * @return the table associated to the given identifier - */ @Override public Optional
getTable(String id) { return this.map.getOpt(id);