IntelliJ IDEA one-line function formatting

Look in Preferences (or Settings), Editor, General, Code Folding, Collapse by default, One-line methods

enter image description here


below is the shortcut for Merge multiple lines into a line -

Ctrl + Shift + J