Gather
Gather[list] gathers the elements of list into sublists of identical elements.
Examples
Group identical elements:
Gather[{a, b, a, c, b, a}]
(* {{a, a, a}, {b, b}, {c}} *)With custom test:
Gather[{1, -1, 2, -2, 3}, Abs[#1] == Abs[#2] &]
(* {{1, -1}, {2, -2}, {3}} *)Please visit the official Wolfram Language Reference for more details.