I need your opinion...
Marek Kozieł
develop4lasu at gmail.com
Fri Mar 27 21:29:09 PDT 2009
5.while-each (same as for-each but ONLY for Iterator-s)
void f( Iterator<List<String>> sheet , boolean containsTitle)
if ( ! iterator.hasNext() ) return;
ArrayList<String> title = ( containsTitle ? iterator.next() : null );
while (ArrayList<String> row : iterator){
...
}
...
}
while-each & final:
void f( Iterator<List<String>> sheet , boolean containsTitle)
if ( ! iterator.hasNext() ) return;
final title = ( containsTitle ? iterator.next() : null );
while (final row : iterator){
...
}
...
}
Normal 1:
void f(List<List<String>> sheet, boolean containsTitle)
if ( sheet.size==0 ) return;
ArrayList<String> title = ( containsTitle ? sheet.get(0) : null );
boolean ignore = containsTitle;
for(ArrayList<String> row : sheet)
if (ignore){
ignore = false;
continue;
}
...
}
...
}
Normal 2:
void f(List<List<String>> sheet, boolean containsTitle)
if ( sheet.size==0 ) return;
ArrayList<String> title = ( containsTitle ? sheet.get(0) : null );
for(int i =1 ; i< sheet.size(); i++)
ArrayList<String> row = sheet.get(i);
...
}
...
}
6. Automatic read-write synchronization through lock-s (this need deep analyze)
Muli-thread applications are future for sure, this is one of the ways
to handle that...
static class Collection<T>{
ReadWriteLock lock =...;
synchronized.read(lock) T get(int i){ ... }
synchronized.write(lock) boolean add(T newElement){ ... }
int addAll(Iterator<T> iterator){
synchronized.write (lock) {
....
}
}
}
7. final interfaces and abstract classes.
make interface final would cause that only specified inheritance would
be possible
final interface A allow B,C{}
interface B extends A{}
interface D extends A{} // compile time error
interface E extends B{} // OK, B allow for that
final class C implements A{} // ok
8. extends WaekReference-s with query allowing re-use objects
--
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł
http://lasu2string.blogspot.com/
More information about the coin-dev
mailing list