On Sun, 2007-12-16 at 19:54 +0100, Gabriel Ebner wrote:
> 
> > Skimming over them using page-down, it's clear which ones are just 
> > "getFoo { return foo; }" and which are more complicated.
> 
> I'm perfectly OK with accessor functions that actually do something
> and that
> make the code clearer (and/or shorter).  But we're talking here about
> one-liners of the form:
> 
>   public int nrNodes() {
>     return nodes.size();
>   }
> 
> They just serve to enforce a certain access pattern. 

This:

class Way {
...
    private final List<Node> private_nodes = new ArrayList<Node>();
    public final List<Node> nodes = Collections.unmodifiableList(private_nodes);

is proving to be quite handy.  We could even make it so that developers
see the Collections.unmodifiableList() bits, but normal users don't.  

-- Dave


_______________________________________________
josm-dev mailing list
[EMAIL PROTECTED]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev

Reply via email to