Wednesday, February 11, 2015

Java 8 lambda example 1

I started some new development work today and decided it is time to start moving to JDK 8.  Looks like existing code compiled as JDK 7 source tends to run ok under JDK 8 already. With some of the new functionality I needed though, it seemed reasonable to start working with actual JDK 8 specifics though.

This is a sample demonstrating some JDK 8 features I am using.


Here is the test class demonstrating some JDK 8 functionality.  

and here is the resulting output:
The regular expression from SampleEnum.flatList() is: (Item1|Item2|Item3|Item4).*
[Item1] matches
[Item3] matches
[Item4 with extra] matches

I am far from an expert on functional programming but I do like to dabble in them.  I do think there are times where the new JDK 8 functionality will promote smaller (and hopefully more maintainable) code.  A famous quote seems appropriate here - "With great power comes great responsibility".  I also foresee some real ugly code being spawned into existence.  I will try to take the good with the bad and try to use the tools at hand to make things better rather than worse. 

Monday, February 9, 2015

Amazing attitudes

I really need to learn from moments like this.  I find I need reminders every so often on how God wants us to respond to adversity. 

In this case, a coworker of mine has been going through cancer issues.  She had to endure surgery and various other unpleasant treatments.  During this process, she has always exhibited a wonderful attitude - smiling and more worried about others than herself.  This was even true after encountering several other very uncomfortable issues around Christmas. 

The topper to this though is her telling me about an encounter a family member (I think?) had.  They had been doing some banking and just loved the attitude of the women they were working with.  They mentioned to the women that they planned to ask only for her for the next 10 years but the women indicated that that would not  be possible.  When asked why, she let them know that her doctor estimated she only had 3 months to live.  She told them she wanted to make the most of the time she had left and didn't want to just sit at home and wait.

These types of encounters remind me that I should think harder about my responses to adversity.  I only wish I didn't need regular reminders.  I am very thankful for the folks that leave a positive mark on my life and I hope I do the same for others.

Thanks for reading and God bless!
Scott

Sunday, February 8, 2015

Son and cotiliion

Phew.  My sons last cotillion was last night and we survived.  He was never very thrilled about it from the beginning but since he didn't find an agreeable activity providing either exercise or social value we found one for him.  We called it an "Opportunity".  As much as he dislikes it, he was still pretty good at picking up the dances.  We did not know about about the cotillion until last year so he was only able to go for final year offered.  I know that starting on the last year didn't help things - knowing almost no one and doing activities you don't really like.  I still think it was worthwhile and hope that someday we will find that it made a positive change in him.  I am proud of him for putting some effort into it even if it wasn't always with a happy heart.

We did get one funny bit of his dry humor out of it.  I had looked over the railing at the the start of their intermission and yelled down "Smiling is contagious" which is one of the statements from the folks that run the cotillion.  My sons response was "Glad I was vaccinated"!  I sighed a bit but had to laugh a while too.