If not already created, a new <code>preference</code> element will be created and returned.
Otherwise, the first existing <code>preference</code> element will be returned.
@return the instance defined for the element <code>preference</code>
766714
public PreferenceType<PortletPreferencesType<T>> getOrCreatePreference()
   {
      List<Node> nodeList = childNode.get("preference");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new PreferenceTypeImpl<PortletPreferencesType<T>>(this, "preference", childNode, nodeList.get(0));
      }
      return createPreference();
   }
60855
public String getPreferencesButton() {

        int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle();
        if (!getCms().getRequestContext().getCurrentUser().isManaged()) {
            return button(
                "../commons/preferences.jsp",
                "body",
                "preferences.png",
                Messages.GUI_BUTTON_PREFERENCES_0,
                buttonStyle);
        } else {
            return button(null, null, "preferences_in.png", Messages.GUI_BUTTON_PREFERENCES_0, buttonStyle);
        }
    }
88659
public Decision<JobXMLDescriptor> getOrCreateDecision()
   {
      List<Node> nodeList = model.get("decision");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new DecisionImpl<JobXMLDescriptor>(this, "decision", model, nodeList.get(0));
      }
      return createDecision();
   }
165910
public T pollFirst() {
    if (head == null) {
      return null;
    }
    T first = head.element;
    this.remove(first);
    return first;
  }
707063
public Property<Properties<T>> getOrCreateProperty()
   {
      List<Node> nodeList = childNode.get("property");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new PropertyImpl<Properties<T>>(this, "property", childNode, nodeList.get(0));
      }
      return createProperty();
   }
1212504
public static <V> AtomicReference<V> newReference(@Nullable V initialValue) {
    return new AtomicReference<V>(initialValue);
  }
838323
public static String getPreference( String preferenceKey, String defaultValue ) {
        Preferences preferences = Preferences.userRoot().node(PREFS_NODE_NAME);
        String preference = preferences.get(preferenceKey, defaultValue);
        return preference;
    }
1057127
@SuppressWarnings("unchecked")
  @Override public E get() {
    if (getPreferences().contains(getKey())) {
      return (E) enumValues[getPreferences().getInt(getKey(), 0)];
    } else {
      return getDefaultValue();
    }
  }
163231
public Id<Attributes<T>> getOrCreateId()
   {
      List<Node> nodeList = childNode.get("id");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new IdImpl<Attributes<T>>(this, "id", childNode, nodeList.get(0));
      }
      return createId();
   }
753682
public FacesConfigBehaviorType<FacesConfigType<T>> getOrCreateBehavior()
   {
      List<Node> nodeList = childNode.get("behavior");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FacesConfigBehaviorTypeImpl<FacesConfigType<T>>(this, "behavior", childNode, nodeList.get(0));
      }
      return createBehavior();
   }
2197
@Override
    protected void createSharedPreferences() {
        super.createSharedPreferences();

        this.sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

        // problem that the first call to getAll() returns nothing, apparently the
        // following two calls have to be made to read all the values correctly
        // http://stackoverflow.com/questions/9310479/how-to-iterate-through-all-keys-of-shared-preferences
        this.sharedPreferences.edit().clear();
        PreferenceManager.setDefaultValues(this, R.xml.preferences, true);

        this.sharedPreferences.registerOnSharedPreferenceChangeListener(this);
    }
1119578
public List<PreferenceType<PortletPreferencesType<T>>> getAllPreference()
   {
      List<PreferenceType<PortletPreferencesType<T>>> list = new ArrayList<PreferenceType<PortletPreferencesType<T>>>();
      List<Node> nodeList = childNode.get("preference");
      for(Node node: nodeList)
      {
         PreferenceType<PortletPreferencesType<T>>  type = new PreferenceTypeImpl<PortletPreferencesType<T>>(this, "preference", childNode, node);
         list.add(type);
      }
      return list;
   }
415285
protected Comparator<RequestMapperBean> newComparator()
	{
		return new Comparator<RequestMapperBean>()
		{
			@Override
			public int compare(final RequestMapperBean o1, final RequestMapperBean o2)
			{
				return o1.getCompatibilityScore() - o2.getCompatibilityScore();
			}
		};
	}
372855
public static PollTcpManagerNio create()
  {
    synchronized (_nioSelectManager) {
      if (_nioSelectManager.get() == null) {
        PollTcpManagerNio selectManager = new PollTcpManagerNio();
          
        if (selectManager.start()) {
          _nioSelectManager.set(selectManager);
        }
      }

      return _nioSelectManager.get();
    }
  }
983025
public static Preference createMultiChoicePreference(
            String name,
            String label,
            MultiChoiceDisplay displayType,
            List<Option> options,
            List<String> defaultValues) {
        MultiChoicePreferenceInput input = new MultiChoicePreferenceInput();
        input.getDefaults().addAll(defaultValues);
        input.setDisplay(displayType);
        input.getOptions().addAll(options);

        Preference pref = new Preference();
        pref.setName(name);
        pref.setLabel(label);
        pref.setPreferenceInput(
                new JAXBElement<MultiChoicePreferenceInput>(
                        new QName("multi-choice-parameter-input"),
                        MultiChoicePreferenceInput.class,
                        input));

        return pref;
    }
1328891
public Version<Attributes<T>> getOrCreateVersion()
   {
      List<Node> nodeList = childNode.get("version");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new VersionImpl<Attributes<T>>(this, "version", childNode, nodeList.get(0));
      }
      return createVersion();
   }
34352
function(element, options) {
      var options = options || {}
      if (element.length) {
        return this.createAll(options, element);
      } else {
        return this.newInstance(element, options);
      }
    }