Mercurial Hosting > luan
view src/luan/LuanMutable.java @ 2111:2a0da93eb0f4 ssltesting
nginx conf relative path fix
| author | Violet7 |
|---|---|
| date | Fri, 19 Dec 2025 02:02:17 -0800 |
| parents | c922446f53aa |
| children |
line wrap: on
line source
package luan; import java.util.Map; import java.util.Collection; public interface LuanMutable { public boolean isImmutable(); public void makeImmutable(); public static void makeImmutable(LuanMutable obj) { if( obj==null ) return; obj.makeImmutable(); } public static void makeImmutable(Object[] a) { if( a==null ) return; for( Object obj : a ) { makeImmutable(obj); } } public static void makeImmutable(Map map) { if( map==null ) return; for( Object stupid : map.entrySet() ) { Map.Entry entry = (Map.Entry)stupid; makeImmutable(entry.getKey()); makeImmutable(entry.getValue()); } } public static void makeImmutable(Collection col) { if( col==null ) return; for( Object obj : col ) { makeImmutable(obj); } } public static void makeImmutable(Object obj) { if( obj instanceof LuanMutable ) makeImmutable((LuanMutable)obj); else if( obj instanceof Object[] ) makeImmutable((Object[])obj); else if( obj instanceof Map ) makeImmutable((Map)obj); else if( obj instanceof Collection ) makeImmutable((Collection)obj); } }
