<Swing Dev> [11][JDK-4842658] RFR: DefaultListModel and DefaultComboBoxModel should support addAll (Collection c)

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Apr 12 21:28:56 UTC 2018


On 10/04/2018 05:43, Krishna Addepalli wrote:
> - Why in one class you use addElements/addElementsAt names and in another addAll?
> In the DefaultComboBoxModel, the functions to add a single element are named as addElement, addElementAt.
> To keep with that convention, I named the apis appropriately.

DefaultListModel also has getElementAt()/addElement()/removeElement() 
etc. I can guess this is because it is a wrapper of Vector which has the 
same methods. But in jdk1.2(when Collection framework was added) some 
additional methods were added to DefaultListModel like 
clear()/get()/set()/add() etc.
I don't urge to change the existing methods in DefaultComboBoxModel but 
it would be good to use one common name pattern for models which is used 
in Collection framework. Any thoughts?


-- 
Best regards, Sergey.



More information about the swing-dev mailing list