Anooj Narvekar

Greenhorn
+ Follow
since Feb 08, 2011
Anooj likes ...
Mac OS X IntelliJ IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anooj Narvekar




I need to figure out what is the Super type of list(in this case its List). Calling getSuperClass returns AbstractList.

PS: sorry if my subject is not appropriate.
12 years ago
Ya.. and


Vector(int initCapacity, int capIncrement )


is to initialize vector with a initial capacity, and capIncrement parameter mentions by how much should the current capacity be increased upon filling the vector.

Think of vector as an Array. Instead of increasing the size of vector at every insert into the vector, providing init capacity makes lot of sense as you will avoid un-necessary array copying and re-inserting
13 years ago
Regex should be used when you want to search something based on a pattern. In this case, regex might be an overhead(negligible though).
13 years ago
You could use indexOf method of String class


PS: note the space while searching(" world"). If you don't give the space, then even search for "World" in string "HelloWorld" would return found.
13 years ago
Collections override toString method. It internally calls toString of Objects its holding. So if the objects its holding has overriden toString as required, then collection.toString should be what you actually want.
13 years ago
Please check the syntax of the sample code you've pasted
13 years ago
Well "Alternately" cause my snippet is not using an Array of arrays. Looks simple with straight forward type-casting.
13 years ago
Alternately, you could do the following:
13 years ago
Hey Wouter,

Ya, the above also works. Well, y the term "difficult" but? The efficiency of code remains same anyways right?
13 years ago
You can use ASCII characters to do this.

Where n is the input no. Also you can have an if check to check the rounding.
13 years ago