In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what the new features of Java5, Java6, Java 7, Java 8 are. The quality of the article is high, so Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.
Java51, Generics:
By referencing generics, it allows you to specify the types of elements in a collection, eliminating cast typing and the benefits of compile-time type checking.
Parameterized Type as parameter and return value, Generic is the cornerstone of vararg, annotation, enumeration, collection.
A. type-safe
Discard List, Map, use List, Map, add elements to them or use Iterator traversal, compile time can check for type errors for you
B. Method parameters and return values plus Type
Discard List, Map, Use List, Map
C. List = new ArrayList();String str = list.get(i);D. Type Wildcard?
Suppose we have a printList method that prints elements from a List, we want any List of type T to be printed, code:
public void printList(List list,PrintStream out)throws IOException{ for(Iterator i=list.iterator();i.hasNext();){ System.out.println(i.next.toString()); } }
What if wildcards? Let's make our parameter type too broad, we can change List and Iterator to List
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.