Change Lists to TreeMap for Addressees, ThematicRoles and ThematicGrids

1 view
Skip to first unread message

Dirk Meier-Eickhoff

unread,
May 27, 2011, 9:25:37 AM5/27/11
to iDocIt Developers
Hi Jan,

I ran into the "problem" that I need to compare the names of the
Addressees, ThematicRoles and ThematicGrids to find existing names.
Futhermore, I want to order the items by name.

At the moment we use ArrayLists for storing Addressees, ThematicRoles
and ThematicGrids. The lists are sometimes ordered and sometimes not.
In most cases the lists are ordered with Collections.sort() or using
another structure like TreeSet.

If we use all over the programm TreeMaps we have no longer the problem
of sorting the collections. And we can find fast existing names in the
collections. Otherwise, I had to convert the lists to TreeMaps do the
searching and ordering and then reconvert the TreeMap to an ArrayList.

But I don't know what effects the refactoring will have to the
program, because on some places the index of the ArrayLists are used
to find indexes in List composites or we use two synchronous lists
where the index is the linking criterion to the elements in the lists.
That must be checked in detail before.

What do you say about that? Is it ok to have the overhead of
converting the lists to TreeMaps and back or should we refactore the
iDocIt!?

Kind regards
Dirk

Jan Christian Krause

unread,
May 27, 2011, 12:40:40 PM5/27/11
to idoci...@googlegroups.com
Hi Dirk,

basically we aren't talking about huge lists of data. I guess there
won't be more than 50 roles/addressees/grids. So from a
performance-perspective I think we can ignore the overhead of sorting
the lists. But an important point would the readability and
understandability of the code. I suggest to create a list of all
affected code-pieces. After that we decide how to proceed. Could you
create such a list?

Greetings from Buxtehude

Jan

Dirk Meier-Eickhoff

unread,
May 28, 2011, 8:50:10 AM5/28/11
to idoci...@googlegroups.com
Ok, I will list the affected code-pieces.

Regards
Dirk

Reply all
Reply to author
Forward
0 new messages