Talk about the collection method
1, such as we enter the space to QQ, and then we have the following force to click the Green box shown in the section to enter the "details" open into
2, after the entry and then click "Details" to find the details of the interface of the "collection", click it can
3, OK now you will see a "collection success" h
Multi-core CPU to take full advantage of CPU performance, it is necessary to use multi-threaded parallel mining CPU potential, parallel programming to the common multithreaded structure abstraction, summed up several typical multithreaded development design patterns. one, the future mode--wonderful no wait when the program submits a request, the server can handle the request very slowly, in the traditional serial program, the function is called syn
(Transferred from: http://blog.csdn.net/yangyan19870319/article/details/6093481)In Java, if you need to set the maximum time for code execution, which is time-out, you can use the Java thread pool Executorservice class with the future interface. The future interface is part of the Java Standard API in the Java.util.concurrent package. The future interface is the
in generic format. Because you cannot upload the callable object to the thread object for execution, you can use the executorservice object to execute the callable object. The Service accepts the callable object and executes it through the submit method. When you submit a callable object to executorservice, a future object is returned. Then, the future get method will be blocked until the task is completed
The Callable interface is similar to Runnable. It can be seen from the name, but Runnable does not return the result and cannot throw an exception in the returned result. The Callable function is more powerful. After being executed by a thread, the return value can be obtained by Future. That is to say, Future can get the return value of the asynchronous execution task. Here is a simple example:[Java]Public
, take the internet industry, those who are familiar with the industry rules of the veteran English is very good, they will stare at the forefront of European and American enterprises every day, once there is a copy of the model will be launched quickly, but unfortunately, We only see their crazy copy of the previous model, basically without their own thoughts and souls, such an atmosphere is particularly prone to irrational entrepreneurial wave. Perhaps, some people can earn some money, but not
Traversal of the 1.Collection collectionThe collection collection is not directly traversed, so we have to be able to traverse it indirectly, we know the array is easy to implement the variable, we can do this:Use object[] ToArray (): Converts a set into an array, enabling the collection to traverseCode implementation:
1. Case of HashMap Collection (hashmapHashmapKey: StudentRequirement: If the member variable values for two objects are the same, then the same object.Value: StringHashMap is the most commonly used map collection, and its key-value pairs are stored with the hash code of the key to determine where the value is placed.An object that is a key in HashMap must override the Hashcode () method of object and the Eq
a callable task to executor, we get a future object, which is like this callable an invoice receipt submitted to executor, using this receipt, In the future we can get the results of the execution of the task, or when we want to cancel the task, we can also take advantage of this task submitted by the future object to cancel the task, and we can also use it to g
Callable and future
The callable interface defines a call method that can act as the executing body of a thread, but the call method is more powerful than the Run method:
A, call method can have return valueB, the call method can declare an exception thrownThe callable interface is a new interface after JDK5 and is not a runnable sub-interface, so the callable object cannot be used directly as target for thread. And the call method also has a return
Navigation of this series of articles
Java multithreading (1)-method join
Java multithreading (2)-EDT in swing (event distribution thread)
In-depth introduction to multithreading (3)-Future asynchronous mode and its implementation in the jdk1.5concurrent package
Introduction to multithreading (4) some ideas on the problem of cachedthreadpool outofmemoryerror
Deep introduction to multithreading (5) use the parallel package thread pool as an example to
Foreign sci-tech media venturebeat on the current situation of weak search innovation, and pointed out that the future of search technology will make content more authoritative, accurate, and has a more diversified form. The knowledge map will provide an important driving force for new searches.Google, a leading company in the search industry, has many advantages and is committed to innovative measures such as knowledge maps and conversational applica
?You Can ' t future-proof SolutionsRichard Monson-haefelToday's solution is tomorrow ' s problemNo one CAn PREdiCT the future. If you accept this as a universal truth and then the question becomes, what's the future of the ahead is? One decade? Years? Twenty minutes? If you can ' t predict the future and then you can '
Reprint: Http://www.jianshu.com/p/cf12d4244171RunnablePublic interface Runnable {public abstract void run (); Runnable's code is very simple, it is an interface and there is only one run (), creating a class to implement it, putting some time-consuming actions in it, and then using a thread to execute the Runnable implementation class to achieve multithreading.CallablePublic interface Callable The callable code is also very simple, but the difference is that it is a generic interface, and t
taskNote that because threads that use cyclicbarrier block on the await method, use Cyclicbarrier in the thread pool with great care, and if the thread pool has too few threads, a deadlock will occurCallable, Future and FuturetaskCallableCallable and Rrunnable, both of which are designed for classes whose instances might be executed by another thread, the main difference being that runnable does not return the result of the threading operation, calla
more about what kind of people to educate, what kind of people can have the ability to adapt to the future society?Today, this article will be the future of a person's core accomplishment in the "will play" two words. When 2040, living very good people should be like this: have taste , can tell stories , can cross the border , some smell , will play , and a little bit of their own small pursuit.If someone
time as the understanding of mechanical language deepened, thinkers gradually realized that industrial design should serve the mass production, for the majority of people to produce useful and beautiful goods, rather than for a few wealthy privileged class to produce luxury goods.
It embodies the concept of modernization and technology, with a new perspective to think about the problem, more emphasis on pragmatic views.
Reject decorative graphics in design, instead emphasizing adherence to ma
1 PackageCom.pang.jihe_demo;2 3 Importjava.util.ArrayList;4 Importjava.util.Arrays;5 Importjava.util.List;6 7 Public classDemo01 {8 Public Static voidMain (string[] args) {9 //Collection-to-array, only reference data types can be loaded in the collectionTenarraylistNewArraylist(); OneList.add (12); AList.add (11); -List.add (9); -object[] Array =List.toarray (); the System.out.println (arrays.tostring (array)); - //Array to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.