mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-11 18:12:57 +00:00
Added example of generic observer
This commit is contained in:
1 parent
c231964227
commit
cb40f1cdbd
7 files changed
+125
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package com.iluwatar.generic;
|
||||
|
||||
import com.iluwatar.WeatherType;
|
||||
|
||||
public class GHobbits implements Race {
|
||||
@Override
|
||||
public void update(GWeather o, WeatherType weatherType) {
|
||||
switch (weatherType) {
|
||||
case COLD:
|
||||
System.out.println("The hobbits are shivering in the cold weather.");
|
||||
break;
|
||||
case RAINY:
|
||||
System.out.println("The hobbits look for cover from the rain.");
|
||||
break;
|
||||
case SUNNY:
|
||||
System.out.println("The happy hobbits bade in the warm sun.");
|
||||
break;
|
||||
case WINDY:
|
||||
System.out.println("The hobbits hold their hats tightly in the windy weather.");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user