For IntelliJ IDEA,

Android Studio or Eclipse

- Add the Codota plugin to your IDE and get smart completions

private void myMethod () {Charset c =

- String charsetName;Charset.forName(charsetName)
- Charset.defaultCharset()
- ContentType contentType;contentType.getCharset()
- Smart code suggestions by Codota
}

/** * Ensures that a CoordinateSequence forms a valid ring, * returning a new closed sequence of the correct length if required. * If the input sequence is already a valid ring, it is returned * without modification. * If the input sequence is too short or is not closed, * it is extended with one or more copies of the start point. * * @param fact the CoordinateSequenceFactory to use to create the new sequence * @param seq the sequence to test * @return the original sequence, if it was a valid ring, or a new sequence which is valid. */ public static CoordinateSequence ensureValidRing(CoordinateSequenceFactory fact, CoordinateSequence seq) { int n = seq.size(); // empty sequence is valid if (n == 0) return seq; // too short - make a new one if (n <= 3) return createClosedRing(fact, seq, 4); boolean isClosed = seq.getOrdinate(0, CoordinateSequence.X) == seq.getOrdinate(n-1, CoordinateSequence.X) && seq.getOrdinate(0, CoordinateSequence.Y) == seq.getOrdinate(n-1, CoordinateSequence.Y); if (isClosed) return seq; // make a new closed ring return createClosedRing(fact, seq, n+1); }

/** * Ensures that a CoordinateSequence forms a valid ring, * returning a new closed sequence of the correct length if required. * If the input sequence is already a valid ring, it is returned * without modification. * If the input sequence is too short or is not closed, * it is extended with one or more copies of the start point. * * @param fact the CoordinateSequenceFactory to use to create the new sequence * @param seq the sequence to test * @return the original sequence, if it was a valid ring, or a new sequence which is valid. */ public static CoordinateSequence ensureValidRing(CoordinateSequenceFactory fact, CoordinateSequence seq) { int n = seq.size(); // empty sequence is valid if (n == 0) return seq; // too short - make a new one if (n <= 3) return createClosedRing(fact, seq, 4); boolean isClosed = seq.getOrdinate(0, CoordinateSequence.X) == seq.getOrdinate(n-1, CoordinateSequence.X) && seq.getOrdinate(0, CoordinateSequence.Y) == seq.getOrdinate(n-1, CoordinateSequence.Y); if (isClosed) return seq; // make a new closed ring return createClosedRing(fact, seq, n+1); }