In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to remove the value of the specified condition in list". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn "how to remove the value of the specified condition in list"!
Remove the value of the specified condition in list under the condition that new objects are not allowed
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
twenty-one
twenty-two
twenty-three
twenty-four
twenty-five
twenty-six
twenty-seven
twenty-eight
twenty-nine
thirty
thirty-one
thirty-two
thirty-three
thirty-four
thirty-five
thirty-six
thirty-seven
thirty-eight
thirty-nine
forty
forty-one
forty-two
forty-three
forty-four
forty-five
forty-six
forty-seven
forty-eight
forty-nine
fifty
fifty-one
Package com.liujianwang.learning
Import java.util.LinkedList
Import java.util.List
Public class ListTest {
Public static void main (String [] args) {
/ *
* remove the value of the specified condition in list if new objects are not allowed.
* for example: remove elements with a value greater than 6 in list.
, /
/ / Test data
List list = new LinkedList ()
For (int I = 0; I 6) {
List.remove (I)
IMurray-
}
}
}
/ * *
* Scheme 2: reverse order processing to avoid indexing problems.
, /
Private static void removeListDesc (List list) {
For (int I = (list.size ()-1); I > = 0; imuri -) {
If (list.get (I) > 6) {
List.remove (I)
}
}
}
}
At this point, I believe you have a deeper understanding of "how to remove the value of the specified condition in list". 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.