class ForkingUDPServer(ForkingMixIn, UDPServer): pass class ForkingTCPServer(ForkingMixIn, TCPServer): pass class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
public interface Collection<T> extends Iterable<T> {
<R> Collection<R> filter(Predicate<T> p)
default { return Collections.<T>filter(this, p); }
}
public interface SwitchableMixin {
boolean isActivated() default { return Switchables.isActivated(this); }
void setActivated(boolean activated) default { Switchables.setActivated(this, activated); }
}
public final class Switchables {
private static final Map<SwitchableMixin, SwitchableDeviceState> SWITCH_STATES = new HashMap<>();
public static boolean isActivated(SwitchableMixin device) {
SwitchableDeviceState state = SWITCH_STATES.get(device);
return state != null && state.activated;
}
public static void setActivated(SwitchableMixin device, boolean activated) {
SwitchableDeviceState state = SWITCH_STATES.get(device);
if (state == null) {
state = new SwitchableDeviceState();
SWITCH_STATES.put(device, state);
}
state.activated = activated;
}
private static class SwitchableDeviceState {
private boolean activated;
}
}
private static class Device {}
private static class DeviceA extends Device implements SwitchableMixin {}
private static class DeviceB extends Device implements SwitchableMixin {}
interface FakeBrokenMixin {
static Map<FakeBrokenMixin, String> backingMap
= Collections.synchronizedMap(new WeakHashMap<FakeBrokenMixin, String>());
String getName() default { return backingMap.get(this); }
void setName(String name) default { backingMap.put(this, name); }
}
interface X extends Runnable, FakeBrokenMixin {}
X makeX() { return () -> { System.out.println("X"); }; }
X x1 = makeX();
X x2 = makeX();
x1.setName("x1");
x2.setName("x2");
System.out.println(x1.getName());
System.out.println(x2.getName());
x1 x2
MyTest$1@30ae8764 MyTest$1@123acf34
x2 x2
MyTest$$Lambda$1@5506d4ea MyTest$$Lambda$1@5506d4ea
private static void lambda$0() {
System.out.println("X");
}
interface Switchable { boolean isActive();
void setActive(boolean active);
}
public interface SwitchableView extends Switchable {
Switchable getSwitchable();
boolean isActive() default { return getSwitchable().isActive(); }
void setActive(boolean active) default { getSwitchable().setActive(active); }
}
public class SwitchableImpl implements Switchable {
private boolean active;
@Override
public boolean isActive() {
return active;
}
@Override
public void setActive(boolean active) {
this.active = active;
}
}
public class Device {}
public class DeviceA extends Device implements SwitchableView {
private Switchable switchable = new SwitchableImpl();
@Override
public Switchable getSwitchable() {
return switchable;
}
}
public class DeviceB extends Device implements SwitchableView {
private Switchable switchable = new SwitchableImpl();
@Override
public Switchable getSwitchable() {
return switchable;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有