Questions tagged [remove-method]
34 questions
47
votes
17 answers
.NET - Remove from a List within a 'foreach' loop
I have code that I want to look like this:
List Os;
...
foreach (Type o in Os)
if (o.cond)
return; // Quitting early is important for my case!
else
Os.Remove(o);
... // Other code
This doesn't work, because you…

BCS
- 75,627
- 68
- 187
- 294
2
votes
2 answers
Remove method in Python
I have the following code:
tree = {'nodes':[1,2,3],'root':[1]}
nodes = tree['nodes']
nodes.remove(2)
print(tree['nodes'])
print(nodes)
The output is the following:
[1, 3]
[1, 3]
My question may be stupid but I do not understand why remove method…

John Snow
- 107
- 1
- 10
2
votes
2 answers
How can I delete integers from list (of integers and strings) by taking which value to delete from user input?
I am doing a menu driven program in python to insert and delete items in a list. I have a list containing integers and strings. I want to delete integer.
So I take input from user as
list = [1, 2, 3, "hi", 5]
x = input("enter the value to be…

Nisarg
- 23
- 5
2
votes
3 answers
Iterating over list but some values are skipped...?
Iterating a list to delete values less than target
I am trying to iterate numList and delete all values less than 8 (target).
Both 2 & 5 are removed correctly but 3 & 7 are not.
It is definitely the remove method. If numList.remove(n) commented…

adamUpchurch
- 111
- 1
- 1
- 5
2
votes
3 answers
How do I remove the last vowel in a string in Ruby?
How can I define the -last vowel- in a string?
For example, I have a word "classic"
I want to find that the last vowel of the word "classsic" is the letter "i", and delete that last vowel.
I'm thinking :
def vowel(str)
result = ""
new =…

Dil Azat
- 113
- 1
- 1
- 9
2
votes
1 answer
Remove the minimum value in a binary search tree
I understand the algorithms but I am not sure how to put it into actual codes. Please help! And also please explain in details. I really want to understand this besides just copying down the answer. ;)
Here are my codes:
public boolean…

user2892181
- 23
- 1
- 1
- 6
1
vote
2 answers
How to take an element out from a list of lists given by an input in python?
this is my very first post and I have minimal if none experience in programming, but I started this course and now I have an exam.
I'm trying to understand how to remove an element from a list of lists given by an input.
M =…

Tommaso Maganzani
- 17
- 4
1
vote
2 answers
Is there a function in GREL to remove many columns at once based on their headers in OpenRefine?
I have a file with 76 columns, out of which 52 columns are irrelevant and should be removed based on their column headers (i.e. string of names). OpenRefine offers the possibility to manually Re-order/remove columns but I was wondering if there is a…

Erfanesi
- 11
- 1
1
vote
1 answer
In jQuery, remove() method does not really remove element
I have a "language switcher" on a Drupal 7 site.
1
vote
1 answer
Iterating through arraylist and removing an object
Title says it all, I'm having some trouble iterating through an arraylist I've made (songs) and removing a specific song once it's been found. I've confirmed that the locations are correct and have tried manually entering in a song's location to no…

Novastorm
- 1,439
- 3
- 26
- 40
1
vote
0 answers
EntityManager "remove" does not delete
I have many entities and for CUD operations i use persist(), merge() and remove() methods, respectively. But delete method below did not work. So i had to use query for deleting a given object. I have googled it but could not find any satisfactory…

Ahmet
- 908
- 1
- 17
- 26
1
vote
3 answers
ArrayList in Arraylist remove method behavior
I have an arraylist that looks like:
private ArrayList> matrix = new ArrayList>(9);
It is filled with these elements:
[[7], [1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9],…

Menno van leeuwen
- 420
- 1
- 4
- 8
0
votes
0 answers
Consider the class LinkedListWithIterator, Provide a remove operation for the inner class IteratorForLinkedList
For my project in my class I have to provide a remove method for the inner class IteratorForLinkedList. Note you will needanother data field. Include interface definition, class implementing the interface, and the test program. I have tried my best…
0
votes
1 answer
Why does remove() method does not work in certain instances?
mepstrip = ['AE38', 'AL29', 'AL30', 'AL35', 'AL41', 'BA37', 'BB37', 'BC37', 'CH24', 'CO26', 'GD29', 'GD30', 'GD35', 'GD38', 'GD41', 'GD46', 'PM29', 'SA24', 'T2V1', 'TDJ3']
indexlist = ['AE38', 'AE38C', 'AE38D', 'AL29', 'AL29C', 'AL29D', 'AL30',…

Juje
- 13
- 3
0
votes
2 answers
how to remove an element from 2d array in java
I want to remove an element after creating the below 2d array.And it should be the last element of the array.
public static void main(String[] args) {
int i;
int row = 2;
int col = 2;
String[][] queue = new…