I want to create code blocks or other formatted text, indent by four spaces in eclipse such like stack-overflow provide coding format.
In my eclipse coding format is
Map<String, Integer> amap = new HashMap<String, Integer>();
try {
BufferedReader buf = new BufferedReader(new FileReader("D:\\t.txt"));
String ss = null;
while ((ss = buf.readLine()) != null) {
String[] pair = ss.split(":");
for (int i = 0; i < pair.length; i += 2)
amap.put(pair[i], Integer.parseInt(pair[1 + i]));
}
buf.close();
for (Map.Entry em : amap.entrySet()) {
System.out.println(" "+em.getKey() + " " + em.getValue());
}
} catch (Exception e) {
}
But I want it in the following format:
Map < String, Integer > amap = new HashMap < String, Integer > ();
try {
BufferedReader buf = new BufferedReader(new FileReader("D:\\t.txt"));
String ss = null;
while ((ss = buf.readLine()) != null) {
String[] pair = ss.split(":");
for (int i = 0; i < pair.length; i += 2)
amap.put(pair[i], Integer.parseInt(pair[1 + i]));
}
buf.close();
for (Map.Entry em: amap.entrySet()) {
System.out.println(" " + em.getKey() + " " + em.getValue());
}
} catch (Exception e) {}
Is it possible to do such like,please help me.Besides have need any plugins for this type of code formatting in eclipse.