@@ -27,17 +27,29 @@ public class Table
2727
2828 public final long id ;
2929
30+ public static Table fromList (LogoList alist ) throws ExtensionException {
31+ Table table = new Table ();
32+
33+ table .addAll (alist );
34+
35+ return table ;
36+ }
37+
38+ public static Table fromMap (Map <?,?> map ) {
39+ Table table = new Table ();
40+
41+ for (Map .Entry <?,?> entry : map .entrySet ()) {
42+ table .put (entry .getKey (), table .getTableValue (entry .getValue ()));
43+ }
44+
45+ return table ;
46+ }
47+
3048 public Table () {
3149 this .id = Table .next ;
3250 Table .next ++;
3351 }
3452
35- public Table (LogoList alist )
36- throws ExtensionException {
37- this ();
38- addAll (alist );
39- }
40-
4153 public void addAll (LogoList alist )
4254 throws ExtensionException {
4355 for (Iterator <Object > it = alist .javaIterator (); it .hasNext ();) {
@@ -59,19 +71,10 @@ public Table(long id) {
5971 next = StrictMath .max (next , id + 1 );
6072 }
6173
62- public Table (Map <?,?> map ) {
63- id = next ;
64- next ++;
65-
66- for (Map .Entry <?,?> entry : map .entrySet ()) {
67- this .put (entry .getKey (), getTableValue (entry .getValue ()));
68- }
69- }
70-
7174 private Object getTableValue (Object value ) {
7275 // return the value to be added in a table being constructed from a Map
7376 if (value instanceof LinkedTreeMap ) {
74- return new Table ((Map <?,?>)value );
77+ return Table . fromMap ((Map <?,?>)value );
7578 } else if (value instanceof ArrayList ) {
7679 LogoListBuilder alist = new LogoListBuilder ();
7780 ((ArrayList <?>)value ).forEach ((temp ) -> {
0 commit comments