Re: Any Checkstyle users?



Dah. I should clarify myself. For example, imagine you have a Hotel
class and want to keep track of your guests

import java.util.HashMap;
public class Hotel
{ private HashMap guests;
//...
public Hotel()
{ guests = new HashMap(50);
}
//...
}

In this example "50" is ambiguous. Why 50?

A slightly better way would be

public class Hotel
{ private HashMap guests;
private static final int MAX_GUESTS = 50;
//...
public Hotel()
{ guests = new HashMap(MAX_GUESTS);
}
//...
}

Now, anybody looking at your code knows that the maximum number of
guests is 50 and that the HashMap "guests" can hold that much data.

.