<Swing Dev> [11] [JDK-8201173] Remove duplicated code in AbstractListModel class

Pankaj Bansal pankaj.b.bansal at oracle.com
Fri Apr 6 09:33:30 UTC 2018


Hi Krishna,

 

The code changes look fine to me. 

Just one suggestion. I think you don't need to create custom UpdateFunction functional Interface here. Java has BiConsumer functional interface, which does what you are trying to do here.

 

Regards,

Pankaj Bansal

 

From: Krishna Addepalli 
Sent: Thursday, April 5, 2018 9:09 PM
To: swing-dev at openjdk.java.net
Subject: <Swing Dev> [11] [JDK-8201173] Remove duplicated code in AbstractListModel class

 

Hi All, 

Please review a fix for 

JDK-8201173: https://bugs.openjdk.java.net/browse/JDK-8201173

Webrev: http://cr.openjdk.java.net/~kaddepalli/8201173/webrev00/

 

There is the duplication of code in fireContentsChanged, fireIntervalAdded, fireIntervalRemoved functions, barring an int parameter and a function call.

Moved the common code into a function called fireUpdates, and defined a functional interface, so that each function can pass its own lambda that does the requisite function call.

 

I have run the tests for JList and JComboBox and observed no new failures.

 

Thanks,

Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180406/61d90083/attachment.html>


More information about the swing-dev mailing list