hashCode() and HashSet, compareTo() and TreeSet

hashCode() and HashSet, compareTo() and TreeSet We often use Set in Java, but the author encountered a problem a few days ago. How to save the class he wrote into Set?? In the process of making force deduction, the generic parameters after Set are all wrapped classes, but some of the classes written by myself are not perfect enough, so the fu ...

Posted by olsrey on Fri, 04 Mar 2022 05:42:21 +0100

Set frame learning

Set frame diagram Note: the dotted line corresponds to the interface and the solid line corresponds to the implementation class Top level interfaces: Collection and Map Interface is to provide methods The Collection interface indicates that the stored data is a Collection composed of single data; The Map interface represents a collection of ...

Posted by Lerris on Mon, 28 Feb 2022 10:22:34 +0100

Python ヾ (≥ ▽≤ *) o SET set type

Python ヾ (≥ ▽≤ *) o SET set type 1, Concept of set Set is one of the data types of Python, which is the same as the concept of set in mathematics Before explaining Python sets, I think it is necessary to review the main categories of mathematical sets: Union, intersection and difference Collections in Python If necessary, Pyth ...

Posted by BrazilMac on Thu, 17 Feb 2022 19:13:56 +0100

In depth analysis of LinkedList source code

brief introductionThe data structures of LinkedList and ArrayList are completely different. The bottom layer of ArrayList is the structure of array, while the bottom layer of LinkedList is the structure of linked list. It can carry out efficient insertion and removal operations. It is based on a two-way linked list structure.Overall structure d ...

Posted by tickled_pink on Fri, 11 Feb 2022 05:33:43 +0100

Java collection source code analysis: ArrayList

After so much preparation, it finally started. Ha, ArrayList Kaigan! ArrayList should be the most frequently used collection class. Let's take a look at how the document introduces it. We can know that ArrayList is actually a replica of Vector, but it only removes thread safety. ArrayList is a List implementation that can be dynamically resize ...

Posted by magie on Thu, 10 Feb 2022 17:56:56 +0100

A thorough understanding of the ArrayList source code

prefaceArrayList is a List implemented by array. Compared with array, it has the ability of dynamic expansion, so it can also be called dynamic array.Any type of data can be stored in the ArrayList collection, and it is a sequential container. The order of stored data is consistent with the order we put it in, and it also allows us to put null ...

Posted by alexscan on Thu, 10 Feb 2022 14:53:29 +0100

What if the List set is unsafe under the condition of multithreading concurrency? The new colleague was directly confused by me

preface Some time ago, a new employee came to the company. He said that the new employee had been outsourcing code for one and a half years before he came to our company. Once I chatted with him about List. I casually asked him how to solve the unsafe multi-threaded concurrency of List collection when outsourcing. Unexpectedly, he looked at me ...

Posted by gdboling on Thu, 10 Feb 2022 13:19:36 +0100

[Python tutorial] Chapter 43 collection

In this article, we begin to learn the Set data types and related operations in Python. Collection data type A collection in Python is an unordered list of immutable elements. This means: The elements in the collection have no order.The elements in the collection are unique. Duplicate elements are not allowed in the collection.Elements in a ...

Posted by upperbid on Sat, 05 Feb 2022 11:05:31 +0100

Theory: Set

You can use collection objects when you need to delete duplicates in a sequence or when you intend to perform some mathematical operations. A collection is an unordered container of hashable objects. You'll learn more about hashable objects later, and now remember that only immutable data types can be elements of a collection. Because of their ...

Posted by asy1mpo on Thu, 03 Feb 2022 20:56:08 +0100

Java foundation -- collection

In the previous article, I have published common interview questions. Here I spent some time sorting out the corresponding answers. Due to my limited personal ability, it may not be in place. If there are unreasonable answers, please give me some advice. Thank you here. This article mainly describes the collection content that is almost necess ...

Posted by maxsslade on Thu, 03 Feb 2022 01:16:27 +0100