[VV36] Unmodifiable maps, SpringBoot release, Java good practices, Angular 16, top skills, Scrum values ups Morale, poll back vs front
???JAVA CERTIFICATION QUESTION:??Unmodifiable maps
Given the following map:
var m = Map.of(1,2,3,4);
Which code fragment is guaranteed to print 37 to the console? Choose one.
A.
m.forEach((x, y) -> System.out.print(x + y));
B.
for (var v : m) {
System.out.print(v.getKey() + v.getValue());
}
C.
for (var v : m.keySet()) {
System.out.print(v + m.get(v));
}
?D.
for (var t : m.entrySet()) {
System.out.print(t.getKey() + t.getValue());
}
?E. None of the above
Answer: None of the above
Look at the effect of the Map.of(1,2,3,4) method call.
It creates a Map<Integer, Integer> with two key-value pairs.
The keys for these pairs are 1 and 3, and the corresponding values are 2 and 4.
Note that the Map.of methods that take arguments in this form treat those arguments as a key, a value, a key, a value, and so on.
The keys and values, of course, will be autoboxed to provide Integer objects.
Since you have two pairs in this Map—1-2 and 3-4—it’s a simple observation of arithmetic that adding the key-value pairs will give the results 3 and 7,
which seems at least promising for producing the desired output.
Now, look at the code of each option in turn.
m.forEach((x, y) -> System.out.print(x + y));
The map.forEach method in this case accepts a BiConsumer<Integer, Integer> as its argument,
and the accept method of that argument will be called with a key and value pair from each key-value pair.
But the iteration of a Map in Java does not provide a predictable order.
for (var v : m) {
System.out.print(v.getKey() + v.getValue());
}
will not compile because?java.util.Map?itself does not implement the Iterable interface required for use in an enhanced for loop.
for (var v : m.keySet()) {
System.out.print(v + m.get(v));
}
extracts a keySet from the Map, which gives you a set of the keys.
But the iteration of a Map in Java does not provide a predictable order.
for (var t : m.entrySet()) {
System.out.print(t.getKey() + t.getValue());
}
iterates over a Set of Map.Entry objects.
But the iteration of a Map in Java does not provide a predictable order.
So none of the answers are correct.
https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Map.html#unmodifiable-> “The iteration order of mappings is unspecified and is subject to change.”
?
?? ?? Spring Boot 3.1.0-RC1 available now
This release includes?112 enhancements, documentation improvements, dependency upgrades, and bug fixes. Notable new features include:
1?? Improved Testcontainers support including support at development time
2?? Support for Docker Compose
3?? SSL Configuration enhancements
4?? Improvements for Docker Image Building
?
? JAVA: All the GOOD PRACTICES ??
Have you ever wondered ?? if you are doing good Java code if you miss the right way to do your method, class, etc?
Here is a website ?? with a great collection of good practices:
javapractices.com?offers concise presentations ?? ?? of Java practices, tasks, and designs, illustrated with syntax-highlighted code examples ?? ??. Some general-purpose?references?are provided, along with some?source code.
Simplicity does not precede complexity but follows it.?- Alan Perlis,?Epigrams In Programming
?? Topics:
Constructors?|?Overriding Object Methods?|?Inheritance?|?Assertions?|?Collections?|?Exceptions?|?Input Output?|?Serialization?|?Threads?|?Common Practices?|?Servlets and JSPs?|?Common Tasks?|?Common Design Patterns?|?Functional Programming?|?Swing?|?Databases?|?Tools?|
?
领英推荐
QUOTE ???
?
??? What’s New in Angular 16 and What To Expect
Angular v16 is the next major release of the Angular framework, and it’s scheduled to be released in May 2023.? Let's browse the new features!
Signals
Signals are a new way of managing state changes in Angular applications.
Signals are functions that return a value (get())and can be updated by calling them with a new value (set()). It looks like React hooks.
Reactivity Model and Zone.js (Zoneless)
Zone.js? is a library that monkey-patches browser APIs to detect changes and trigger change detection in Angular applications. n Angular v16, Zone.js will be optional for performance purposes.
Required Component Inputs
This feature will allow developers to mark some inputs of a component as required, meaning the parent component must provide them, or else an error will be thrown.
Non-Destructive Hydration
Hydration in Angular is the process of converting server-rendered HTML into a fully functional client-side application by attaching event handlers and initializing components. In Angular 16, hydration will be supported out of the box.
?
???? NEW in LinkedIn: The TOP SKILLS section
A new feature in LinkedIn to display your top skills??
If you want to display it go to your About section where you do your personal presentation, there is a part to add your top skills.
Happy self-branding!
?
SCRUM: How Following the Scrum Values Helps Improve Morale by John Gillespie
<<Everyone who's worked with Scrum for a while knows that the core values are the lifeblood ?? of the framework.
Today, I'm going to touch on Focus and Commitment.
1?? Recently, I've been working with a new team.
They didn't quite buy ?? into the values of Scrum so I had to ask them to trust me and give it a try for a while.
To start with, they weren't successfully meeting their sprint goal ?? and team morale was pretty low.
The team however did agree that the sprint goal commitment was important ??.
2?? So they spent some time in a retrospective looking ??? for a cause.
They determined that one or more team members were not remaining focused on the sprint goal and this was likely the cause of the shortfall ??.
So the team decided to change the focus of their daily scrum from the 3 basic statements ?? ♂?: what did I do yesterday? what do I tend to do today? and do I see any impediments?
Now the Team would focus this collaboration time specifically on the next day's ?? effort related to the sprint goal.
They also committed to challenging ?? each other if it looked like one of the team members was not remaining focused on the sprint goal.
3?? This relatively simple change of dialog had a dramatic impact on the team's success ??. Over the past 10 sprints, the team achieved 100% of their sprint goal ??. Needless to say, that team morale is now pretty high ??.
4?? Last week I spoke with the team about their feelings ?? about respecting scrum and traditional software methods. All of them indicated now that they understand the value of scrum and would not go back ?? ♂? to traditional methods.
If the team hadn't had the courage and openness to try a new approach along with the resolution to focus on the sprint goal commitment. It is unlikely that they would be realizing the success that they see today.
5?? I see this all the time in my work as a coach ?? ??.
When the scrum team actually embraces ?? the core values (courage, focus, commitment, respect, openness), they bring the framework to life.
Thank you for listening today ??.>>
?
POLL: BACK versus FRONT ????
?
Senior JavaScript Developer | Daily Coding Tips
1 年This post covers a range of topics from Java to Angular and even Scrum. I've found learning about unmodifiable maps in Java to be useful. Additionally, the new Spring Boot update is worth checking out, I also think the new TOP SKILLS section in LinkedIn can be helpful for job seekers.