How do I replace a specific element in the linkedhashset?

Using ArrayList, I will do similar things

myList.set(myList.indexOf(oldItemNumber),newItemNumber);

Is there a simple way to implement linkedhashset?

Solution

This question is meaningless to a set The new object added to the set is either equal to the existing object (in which case there is no response) or not (in which case it is added at the end)

You cannot insert an object in a specific location without deleting and re adding everything

You may want to see TreeSet, which allows you to keep an ordered set that will be kept sorted by the provided comparator when you add and delete objects

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>