List Trim Demo This is a simple demonstration of how to trim the elements of a list in Java. A list is a string of comma-separated strings. This is the input. The output will be a List of strings. Nine difference implementations are given.