[ https://issues.apache.org/jira/browse/PIVOT-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13964983#comment-13964983 ]
Roger Whitcomb commented on PIVOT-941: -------------------------------------- Hmm, in the java.util.List interface, the "add()" method returns a boolean as to whether or not it was added (or existed previously). The "indexOf" method returns an index of an item in the list. So, I think I'd rather emulate that interface and (if anything) add the "indexOf" method (or rather just make it "public" since it already exists in the class). We could also (perhaps) make the "add" method return a boolean, like its java.util counterpart. Although, I kind of like the idea of returning the index where it was added.... But, changing the signature of this method would break binary compatibility, so we should defer that to 2.1 (if we decide to do it). But, probably this discussion should be done in the face of looking at all the Pivot List and Map classes, in view of another JIRA issue about making them more like the java.util classes.... But, to answer your direct question: making the index number available wouldn't help me too much right now -- basically I know there will only be the skin and myself on the list, so I don't need to be told where my listener is in the list. But, probably in general we should have a way to do this (as I outlined above), but we should do in as part of beefing up all the Pivot List and Map classes. My 2 cents.... > Allow random access to ListenerList elements with a "get" method > ---------------------------------------------------------------- > > Key: PIVOT-941 > URL: https://issues.apache.org/jira/browse/PIVOT-941 > Project: Pivot > Issue Type: Improvement > Components: core-util > Affects Versions: 2.0.3 > Environment: All > Reporter: Roger Whitcomb > Assignee: Roger Whitcomb > Priority: Trivial > Fix For: 2.0.4, 2.1 > > > I'm finding that sometimes I need quick access to a particular listener (for > instance, the one I added to a component vs. the one added by the skin), and > for this instead of iterating through the list I would like to just get a > particular one. Most Java lists allow arbitrary access to a particular > element, so I propose adding a "get(int)" method to the ListenerList class > that returns the particular element (if it exists). -- This message was sent by Atlassian JIRA (v6.2#6252)