I have a set of objects in an ArrayList. At certan points in my program, I have to set some of the objects equal to null. Then, at another point in my program, I have to remove all those null items from the ArrayList. Here's a snippet of the code:
// Remove nulls for the new set
ArrayList removeIndex = new ArrayList();
for (int i = 0; i < Count; ++i)
{
if (this[i] == null)
{
removeIndex.Add(i);
}
}
for (int i = 0; i < removeIndex.Count; ++i)
{
InnerList.RemoveAt(Convert.ToInt32(removeIndex[i]));
}
I have to have two for loops. One to find all the index values of null values, and the second to remove them (removing from an array you are looping through is a bad idea :D).
The problem is the RemoveAt statement. When I try to RemoveAt an index that is null, I get an ArgumentNull exception.
I don't see any other way around what I'm doing, besides a LOT of complicated math. Am I missing something, or is this impossible?
I suspect they don't want to move the memory controller to the compute tile, if for no other reason, they want to be able to park the compute tile on a laptop when it is sleeping. I suspect Intel will continue to enhance the way their new tile architected works. It's for that reason why AMD's 3D cache CPUs do so much better for gaming, it helps offset the latency added by putting the memory controller on the I/O die. Intel made it clear long ago that gamers are not who the design chips for, so I wouldn't hold your breath.
LP cores are MUCH lower power than Efficiency cores. Efficiency cores never really lived up to their name, but they did add a meaningful amount of performance in multithreaded loads, so Intel isn't going to remove them.
I don't usually say this, but WTF Microsoft?! Do you hate your customers, or do you just really not care at all? Windows Hello is one of the useful Windows features, and now you're effing it up.
Question
Sn1p3t
Don't ask why, but I am in a situation like this:
I have a set of objects in an ArrayList. At certan points in my program, I have to set some of the objects equal to null. Then, at another point in my program, I have to remove all those null items from the ArrayList. Here's a snippet of the code:
I have to have two for loops. One to find all the index values of null values, and the second to remove them (removing from an array you are looping through is a bad idea :D).
The problem is the RemoveAt statement. When I try to RemoveAt an index that is null, I get an ArgumentNull exception.
I don't see any other way around what I'm doing, besides a LOT of complicated math. Am I missing something, or is this impossible?
Link to comment
https://www.neowin.net/forum/topic/249626-net-remove-null-items-from-arraylist/Share on other sites
1 answer to this question
Recommended Posts