Patternts implementations on java