本文整理汇总了Java中java.util.Dictionary.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Dictionary.isEmpty方法的具体用法?Java Dictionary.isEmpty怎么用?Java Dictionary.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Dictionary
的用法示例。
在下文中一共展示了Dictionary.isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addService
import java.util.Dictionary; //导入方法依赖的package包/类
@Override
@SuppressWarnings ( "unchecked" )
public synchronized void addService ( final String id, final S service, Dictionary<?, ?> properties )
{
if ( this.disposed )
{
return;
}
if ( properties == null || properties.isEmpty () )
{
properties = emptyHashtable;
}
else
{
properties = new UnmodifyableDictionary<Object, Object> ( (Dictionary<Object, Object>)properties );
}
logger.debug ( "Adding service: {} -> {} -> {}", new Object[] { id, service, properties } );
Map<S, Dictionary<?, ?>> serviceMap = this.services.get ( id );
if ( serviceMap == null )
{
serviceMap = new HashMap<S, Dictionary<?, ?>> ( 1 );
this.services.put ( id, serviceMap );
}
final Dictionary<?, ?> oldService = serviceMap.put ( service, properties );
if ( oldService != null )
{
logger.warn ( "Replaced service: {}", new Object[] { id } );
}
fireAddedService ( id, service, properties );
}
示例2: requireNonEmpty
import java.util.Dictionary; //导入方法依赖的package包/类
public static <K,V> Dictionary<K,V> requireNonEmpty(String objName, Dictionary<K,V> obj) {
Objects.requireNonNull(obj, objName + " must not be null");
if (obj.isEmpty()) {
throw new IllegalArgumentException(objName + " must not be empty");
}
return obj;
}