Created
December 14, 2016 02:21
-
-
Save dnorton/c7c637ad8da67f622eb76f8f6e47ca95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dedupe(original): | |
"""method to remove unnecessary ; and duplicate values""" | |
value_set = set(filter(bool, map(lambda it: it.strip(), original.split(';')))) | |
return '; '.join(list(value_set)) |
Actually it would have been 1 line in Java, very similar to what you have here, using the functional features of Java.
Let's see that line!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
practice makes perfect with python. This would have been 300+ lines in Java.