In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to express java7 diamond grammar". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to express java7 diamond grammar"!
In response to the tedious problem of creating generic definitions and instances, Java 7 has made an improvement to reduce the number of keystrokes when dealing with generics. For example, you use userid (integer value) to identify some user objects, and each user corresponds to one or more lookup tables 1. How should this be expressed in code?
A processing mechanism that replaces computing with queries in order to improve processing speed. Generally, the pre-calculated result is stored in an array or mapping, and then read directly when the result is needed, such as using a triangulation to check the sine of an angle. -- translator's Note
Map usersLists = new HashMap ()
This is simply too long, and almost half of the characters are repeated. If it can be written as
Map usersLists = new HashMap ()
Is it better for the compiler to infer the type information on the right? The magical Coin project fulfills your wish. In Java 7, declaration abbreviations like this are perfectly legal and backward compatible, so when you need to deal with previous code, you can get rid of the tedious declarations of the past and use the new type inference syntax to save some space.
The compiler adopts a new form of type inference for this feature. It infers the correct type on the right side of the expression, rather than just replacing it with text that defines the full type.
Why is it called "Diamond Grammar"
It is called "diamond syntax" because this type of information looks like a diamond. The name in the original proposal was "Type inference improvements for generic instance creation" (Improved Type Inference for Generic Instance Creation). The name is too long, but the acronym ITIGIC sounds silly, so it's simply called diamond grammar.
The new diamond syntax is sure to make you write less code. Finally, we will explore a feature in the Coin project-warning messages when using variable parameters.
At this point, I believe you have a deeper understanding of "how to express java7 diamond grammar". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.