[jira] [Comment Edited] (PIVOT-999) Update code to take advantage of Java 8 features

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jira] [Comment Edited] (PIVOT-999) Update code to take advantage of Java 8 features

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/PIVOT-999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16030038#comment-16030038 ]

Roger Whitcomb edited comment on PIVOT-999 at 5/30/17 8:32 PM:
---------------------------------------------------------------

Many more submissions in the last couple of days to add to this issue:
Revision 1796934:
PIVOT-999: Add a DictionaryTest to test the new default "getIntValue" and
"setIntValue" methods in the Dictionary interface.

Revision 1796922:
PIVOT-999:  Update all the listener list notification methods in Component so that they use the new Java 8 "forEach" iteration method.  This also involves using a new BooleanResult class to tally the results of the "consumed" logic where the final result is the logical OR of all the individual results.

So, add the BooleanResult class, including methods to do all the logical operations on the result.

Add VoteResultTest and BooleanResultTest to the unit tests so we can verify that these basic classes perform correctly.

Revision 1796915:
PIVOT-999: Add a test class for ImmutableIterator to make sure the changes made for Java 8 didn't break anything.

Revision 1796910:
PIVOT-999:  Take advantage of default interface methods in Java 8:
Remove the "remove()" method in EmptyIterator because it is already implemented by the default.

Add some more explanatory Javadoc also.

Add a test class for EmptyIterator to make sure this all works.

Revision 1796903:
PIVOT-999:  Take advantage of default interface methods in Java 8:
Remove the "remove()" method in ImmutableIterator because it is already implemented by the default.

Other cleanup in ImmutableIterator also.

Revision 1796874:
PIVOT-999: Use the new "forEach" iterator with lambdas to simplify the ListenerList notification code in Window.  Also clean up some other code in there while I'm at it.

In order to work with this iteration technique, had to add a new VoteResult class that just holds an effectively final Vote, and does the tally with the internal value.  That way, the VoteResult itself doesn't have to change during the iteration, fulfilling the requirement of being effectively final.

Revision 1796713:
PIVOT-999:  Use the new default "getIntValue()" and "setIntValue()"
methods in the Dictionary interface.

Revision 1796710:
PIVOT-999 and others:  More use of Utils.checkNull to validate input parameters;
Using Dictionary.getIntValues for int valued styles in many places.

Revision 1796686:
PIVOT-999: Another round of taking advantage of Java 8 features, plus some other changes:
* Use the new default "getIntValue" and "setIntValue" of Dictionary
  to good advantage in Insets and Point.
* Allow Insets to be decoded from a JSON array/list as:
  "[ top, left, bottom, right ]" in addition to a map with these
  values.
* Use "Utils.checkNull" for parameter validation as appropriate.



was (Author: rwhitcomb):
Many more submissions in the last couple of days to add to this issue.

> Update code to take advantage of Java 8 features
> ------------------------------------------------
>
>                 Key: PIVOT-999
>                 URL: https://issues.apache.org/jira/browse/PIVOT-999
>             Project: Pivot
>          Issue Type: New Feature
>          Components: all
>    Affects Versions: 2.1
>         Environment: All
>            Reporter: Roger Whitcomb
>            Assignee: Roger Whitcomb
>
> Some features that we could potentially use include:
> * default methods in interfaces to extend features while maintaining backward compatibility
> * lambdas for such things as callbacks
> * really use functional interfaces (already kind of present, but not really used)
> * "forEach" in many places for Iterable collections



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Loading...