javac#eclipsefolding

Java equivalent to #region in C#


I want to use regions for code folding in Eclipse; how can that be done in Java?

An example usage in C#:

#region name
//code
#endregion

Solution

  • There's no such standard equivalent. Some IDEs - Intellij, for instance, or Eclipse - can fold depending on the code types involved (constructors, imports etc.), but there's nothing quite like #region.