Eclipse reload problem.

Everything with my coding was fine and I even put up my chat status as ” I love Eclipse.” and right then within an hour, all my code stopped working with no tampering whatsoever. I restarted it, restarted my computer, put it to sleep for hours ( ofcourse myself too) to find that the problem still exists. When I checked the Error Log it showed this

System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences

I was stumbling, its about 2 AM so couldnt contact anyone who might have had a similar experience. So I took a chance and did the following.

On Servers panel, I right clicked on my server ( Tomcat 7 here but I think that is not an issue) and clicked on “Clean”. It took a couple of minutes to clean everything ofcourse with a warning but that reverted back everything to normal. If anyone is having a similar problem, hope this helps.

Removing elements from Arrays in java.

As far as I know removing elements from arrays is not trivial. Instead of multiple iterative loops, the best way to actually do it is to covert it to ArrayList, add all the elements to the collection and remove the unneccesary elements. This method is particularly useful when the element removed is known and occurs multiple times, like “null” in a string array.

example.

I had an array of strings, which was result of a regex pattern match. it is named as “sentArray2”. To remove the null elements from it, I successfully implemented this following code.

The implementation is like this:

String array —–> ArrayList —-> Update(remove elements) Array list –> Convert back into string array ( I converted back into a new one but its not necessary).

// Create an ArrayList to remove null elements easily

ArrayList sentenceFinal = new ArrayList();

// Step to add all the elements into the ArrayList

for (int e=0;e<sentArray2.length;e++)

{

Collections.addAll(sentenceFinal, sentArray2[e]);

}

// Step to remove all the null elements in a single shot.

sentenceFinal.removeAll(Collections.singleton(null));

// Converting the ArrayList back to String array

String[] sentFinal = new String[sentenceFinal.size()];

sentenceFinal.toArray(sentFinal);