John Freeman

+ Follow
since Nov 13, 2015
John likes ...
Eclipse IDE Firefox Browser Java
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Freeman

Thank you all for the responses everyone!

Campbell, your output was not quite what I was looking for, because my values for the outer map are Map<String, String> rather than List<ErrorMessage>, but thanks for your tip about the indentation style.

Knute, thanks for bringing up toMap and Stephan for the thorough response of the alternatives in Java 8, it has given me a much better understanding of how to use it fit a requirement, as well as for the optimization of my current code, it has definitely opened up my mind to put an effort into making my code more efficient. And finally, Rob you are right, the filter check is not needed in this scenario because all of the ErrorMessage objects in the stream are assumed to have a valid errorType String.

Looks like I need to book my books again for Java 8 as well as just keep practicing!
7 years ago
I have the following simple class:

As well as the following driver program:

And I get the output as expected/required:

{Network={AA=NetworkUnavailable, AB=NetworkDown, AC=NetworkSlow}, Data={AA=DataCorrupted, BC=DataOutdated}}

My question is, how can I get the same logic using Java 8 features? I spent some time trying to wrap my mind around it, but I did not get anywhere.

7 years ago
I have recently become interested in the Certified Ethical Hacker certification, and I was wondering if anyone could share their experiences with it if they have achieved it.

Tim Holloway wrote:Sounds like the original app was a Windows app and someone thinks (hopes) that time and effort can be saved because "All You Have To Do Is" port it to the web.

How realistic that dream is is hard to say. If the original app was .Net-based, then there may be SOME portable code, although the cynic in me notes that sometimes code written in language A for Platform X require so much adaptation to move to Platform Y that it would have been faster and less expensive to simply rewrite the code from scratch. That can often be true even when switching platforms in Java.

I note with alarm that even if you do this, apparently you're going to be stuck with it for the indefinite future if no one else understands the platform but you.

There's nothing inherently wrong with being a .Net developer. Plenty of work on that platform. But the primary question is how much of a .Net guru do you wish to become?

Thank you for your thoughts Tim. The app will be developed new without any porting because the existing application is in fact a Windows app. I intend on documenting everything as I start to design things, so that when the time comes for me to leave, my replacement (I will tell them to hire someone with .net experience of course; when I joined the project it was a very open ended type thing so I got on board hoping it would go down the Java path with the goal just to modernize) will be able to pick things up without much trouble. I don't know the answer to that final question you posted, but I decided to learn as much as possible to get a mostly finished decent quality product within 6 to 7 months, and then hope to get back to the Java world professionally.
7 years ago

Bear Bibeault wrote:Curious: if nobody knowns .NET why was it chosen?

It was chosen because the existing systems and licenses are all Microsoft based (SQL server, visual studio, Visual C++ etc.).
7 years ago

I am a somewhat recent college graduate (bachelor's completed four years ago), and I consider myself as a junior level developer still. I have been exposed to various areas in the IT/development world, and a stable Java development position has always eluded me (always getting pulled into other areas like testing, database development, project contract losses causing issues etc.). Now I have ended up in a position where I am to develop a new web-app version of a small (but not that small) desktop server application using the .net framework (it was not my decision to use this technology). What I want to know is, would it be a good idea to stick with this position? I have never been tasked with so much responsibility, especially without a mentor (no one on this project, including me, knows .NET development), so I am nervous, especially since I am learning things on my own. On one hand, I think this is a great learning opportunity to create an application from scratch, but on the other hand, I am hesitant because my career goal is to grow as a Java developer. As I learn more about .net MVC development and C#, I am seeing that many of the concepts could be transferable to Java web development (if my understanding is correct), so this worry is becoming less of an issue, but what I am worried about is whether I am unknowingly getting too far off the Java path (EJB, Spring, Hibernate, etc), losing time by developing in a different platform. The Java experience I have professionally is limited, so even though I have been in the working world for 4 years, I feel I am falling behind getting some kind of depth. My Java now-a-days is limited to studying for the higher level certifications, and I don't know how useful they are going to be a few months down the road.

Thank you for reading the long post, and I appreciate any input.
7 years ago

Frits Walraven wrote:

How do you recommend reading the specs? I have always studied for exams from dedicated study guides, but when you read something all-purpose like the specifications, how do you know you have learned enough to pass the test

The majority of the EE-certifications do not have dedicated study guides like OCA or OCP. The EJB-specifications are quite readable by the way. I read them after reading the Enterprise JavaBeans 3.1 book and before attempting the Enthuware mocks.

Would doing the Enthuware exams (at least the first one or two) after reading through the books be a good idea to learn what to focus on in the specs, based on the answers missed?

Yes, that is a good plan. The Enthuware mocks cover the most important parts of the specifications. You might want to use my summary of the EJB specs for reference as well: OCEEJBD-Links.

Thank you very much Frits. I will surely look at your summary.

Frits Walraven wrote:

2. Is there any topic not well covered in this book & do you suggest some other material for the exam as well?

This book is a nice book but it doesn't prepare you for the exam. I read the EJB specifications and did some mock exams.

Just check the Certification-results forum and read what others did to prepare for the exam.

How do you recommend reading the specs? I have always studied for exams from dedicated study guides, but when you read something all-purpose like the specifications, how do you know you have learned enough to pass the test? I have the book EJB 3.0 in Action, as well as the EJB 3.1 book mentioned above, and I have purchased the Enthuware exams as well. Would doing the Enthuware exams (at least the first one or two) after reading through the books be a good idea to learn what to focus on in the specs, based on the answers missed?
Thank you very much for the detailed reply K.Tsang! It sure does sound like a lot of work will be needed. I was leaning towards the EJB expert exam and it's good to know from you that it is the most helpful one on the path to JEA. One thing I wanted to ask regarding that, as you said "EJB 3 in Action 2e = detail coverage of EJB3 and JPA, suitable for EJB developer cert " , do you have an opinion on the Enterprise JavaBeans 3.1 6th Edition book by Rubinger and Burke, since it covers EJB 3.1, which is what is on the exam? Once I get past the EJB milestone, I will start on the other resources you mentioned for the architect path. You mentioned that the WS exam was practically useless for your Java Architect certification, but I see that you are also a certified component developer. Did that help for the JEA?

Thanks again for the detailed response, I am excited to continue learning!

I have set a goal of acquiring the OCMJEA 6 certification, and I wanted to know whether it is a good idea to try to get all the expert level certifications (5 currently as per this link: link). I have very limited on-the-job Java EE experience (currently not working in Java), so I am going through courses on Udemy and reading books on Java EE related topics to learn. I appreciate any suggestions on what to do to achieve the master level certification (other than passing the required exams ).

See what the output is when you add the following above line 4 inside the loop:

System.out.println("before increment: "+i);

and the following after line 4 and before line 5:

System.out.println("after increment: "+i);
As a side note, if you are new to learning Java, one thing I found helpful to remembering concepts, methods, API, etc. is to put them in the context of imaginary scenarios and then practice, rather than just trying to remember things without context.

Scott Selikoff wrote:See the paragraph after this example: "The first example actually throws an exception at runtime, as URIs must reference absolute paths at runtime" and see the feature on the previous page titled "Absolute vs a Relative is file system dependent".

In other words, it is file system dependent to some degree whether the runtime exception will be thrown.

Thanks for the reply Scott. In the example I posted above, I added a check :


and this returned true, so this explained why this resulted in no runtime exception.

Then I tried this:

and this time I got a runtime exception. So it seems like the schema "file://" made the difference in making it an absolute path on my system, therefore I didn't need the 3 slashes as in path3 on page 458.
On page 458 of the study guide for OCP8 (Boyarsky, Selikoff) it is stated that the first Path statement below:

Path path1 = Paths.get(new URI("file://pandas/cuddly.png"));

Results in a runtime exception. However when I tried this on my own system (Windows 10), I did not get any runtime exception. Can someone help with this please?

Jeanne Boyarsky wrote:

John Freeman wrote: So it seems that the difference between our code boils down to the fact that you used "Reference Library" as your instance string, while I used "R" in mine.

Correct. That's because "Reference Library" starts with "Reference", but "R" does not start with "Reference"

John Freeman wrote: If I understood your explanation correctly, "Reference Library"::startsWith translates to "Reference Library".startsWith("Reference Library") in traditional Java syntax. I don't understand how changing it to just "R" caused it to behave unexpectedly, but it worked for "Reference Library"

No. "Reference Library"::startsWith translates to "Reference Library".startsWith("Reference"). or "Reference Library"::startsWith("AnotherValueInYourList")

Thanks Jeanne, I think I finally get it now.