/** * Create a new attribute set. * @param names The list of attributes. * @return The attribute set. */ public static AttributeSet create(List<? extends TypedName<?>> names) { Preconditions.checkArgument(names.size() > 0, "no attribute names"); TypedName[] arr = names.toArray(new TypedName[names.size()]); if (arr[0] != CommonAttributes.ENTITY_ID) { int iidx = names.indexOf(CommonAttributes.ENTITY_ID); if (iidx >= 0) { TypedName n = arr[0]; arr[0] = arr[iidx]; arr[iidx] = n; assert arr[0] == CommonAttributes.ENTITY_ID; } } return setCache.intern(new AttributeSet(arr)); }
/** * Create a new attribute set. * @param names The list of attributes. * @return The attribute set. */ public static AttributeSet create(List<? extends TypedName<?>> names) { Preconditions.checkArgument(names.size() > 0, "no attribute names"); TypedName[] arr = names.toArray(new TypedName[names.size()]); if (arr[0] != CommonAttributes.ENTITY_ID) { int iidx = names.indexOf(CommonAttributes.ENTITY_ID); if (iidx >= 0) { TypedName n = arr[0]; arr[0] = arr[iidx]; arr[iidx] = n; assert arr[0] == CommonAttributes.ENTITY_ID; } } return setCache.intern(new AttributeSet(arr)); }