List of usage examples for java.lang Object equals
public boolean equals(Object obj)
From source file:WeakCanonicalSet.java
protected boolean equals(Object a, Object b) { return a.equals(b); }
From source file:com.cburch.draw.tools.DrawingAttributeSet.java
public <V> void setValue(Attribute<V> attr, V value) { Iterator<Attribute<?>> ait = attrs.iterator(); ListIterator<Object> vit = values.listIterator(); while (ait.hasNext()) { Object a = ait.next(); vit.next();/*from ww w .ja v a 2 s . c om*/ if (a.equals(attr)) { vit.set(value); AttributeEvent e = new AttributeEvent(this, attr, value); for (AttributeListener listener : listeners) { listener.attributeValueChanged(e); } if (attr == DrawAttr.PAINT_TYPE) { e = new AttributeEvent(this); for (AttributeListener listener : listeners) { listener.attributeListChanged(e); } } return; } } throw new IllegalArgumentException(attr.toString()); }
From source file:com.cburch.draw.tools.DrawingAttributeSet.java
public <V> V getValue(Attribute<V> attr) { Iterator<Attribute<?>> ait = attrs.iterator(); Iterator<Object> vit = values.iterator(); while (ait.hasNext()) { Object a = ait.next(); Object v = vit.next();//from ww w . j a v a2s . c om if (a.equals(attr)) { @SuppressWarnings("unchecked") V ret = (V) v; return ret; } } return null; }
From source file:com.haulmont.cuba.gui.data.impl.HierarchicalPropertyDatasourceImpl.java
@Override public Collection<K> getChildren(K itemId) { if (hierarchyPropertyName != null) { final Entity item = getItem(itemId); if (item == null) return Collections.emptyList(); List<K> res = new ArrayList<>(); Collection<K> ids = getItemIds(); for (K id : ids) { Entity<K> currentItem = getItem(id); Object parentItem = currentItem.getValue(hierarchyPropertyName); if (parentItem != null && parentItem.equals(item)) res.add(currentItem.getId()); }//from ww w. j a va2 s . co m if (StringUtils.isNotBlank(sortPropertyName)) { Collections.sort(res, new Comparator<K>() { @Override public int compare(K o1, K o2) { Entity item1 = getItem(o1); Entity item2 = getItem(o2); Object value1 = item1.getValue(sortPropertyName); Object value2 = item2.getValue(sortPropertyName); if ((value1 instanceof Comparable) && (value2 instanceof Comparable)) return ((Comparable) value1).compareTo(value2); return 0; } }); } return res; } return Collections.emptyList(); }
From source file:MicroMap.java
/** * @see java.util.Map#containsKey(java.lang.Object) *//* ww w .j av a2s. co m*/ public boolean containsKey(final Object key) { return key.equals(this.key); }
From source file:MicroMap.java
/** * @see java.util.Map#get(java.lang.Object) *//* ww w. j a va 2 s . co m*/ public Object get(final Object key) { if (key.equals(this.key)) { return value; } return null; }
From source file:com.jaspersoft.studio.components.chart.model.theme.MLegendSettings.java
@Override public Object getPropertyValue(Object id) { LegendSettings ts = getValue();//ww w . j a v a 2s . co m if (id.equals(LegendSettings.PROPERTY_showLegend)) return Misc.nvl(ts.getShowLegend(), Boolean.TRUE); if (id.equals(LegendSettings.PROPERTY_font)) { clFont = MFontUtil.getMFont(clFont, ts.getFont(), null, this); return clFont; } if (id.equals(LegendSettings.PROPERTY_position)) return posD.getEnumValue(ts.getPositionValue()); if (id.equals(LegendSettings.PROPERTY_horizontalAlignment)) return hp.getEnumValue(JFreeChartHorizontalAlignmentEnum.getValue(ts.getHorizontalAlignment())); if (id.equals(LegendSettings.PROPERTY_verticalAlignment)) return vp.getEnumValue(JFreeChartVerticalAlignmentEnum.getValue(ts.getVerticalAlignment())); if (id.equals(LegendSettings.PROPERTY_backgroundPaint)) return ts.getBackgroundPaint(); if (id.equals(LegendSettings.PROPERTY_foregroundPaint)) return ts.getForegroundPaint(); Object pad = PadUtil.getPropertyValue(id, ts.getPadding()); if (pad != null) return pad; BlockFrame bf = ts.getBlockFrame(); if (bf != null) { pad = PadUtil.getPropertyValue(id, bf.getInsets(), LegendSettings.PROPERTY_blockFrame); if (pad != null) return pad; } return null; }
From source file:com.worldline.easycukes.commons.helpers.JSONHelper.java
/** * Returns <b>true</b> if JSON array a1 is equals to JSON array a2. * * @param a1 a {@link JSONArray} containing some JSON data * @param a2 another {@link JSONArray} containing some JSON data * @return true if the json arrays are equals *///from w w w .j av a 2 s. c o m public static boolean equals(@NonNull JSONArray a1, @NonNull JSONArray a2) { if (a1 == a2) return true; if (a1.size() != a2.size()) return false; final ListIterator i1 = a1.listIterator(); ListIterator i2; boolean found = false; while (i1.hasNext()) { final Object o1 = i1.next(); found = false; i2 = a2.listIterator(); if (o1 instanceof JSONObject) while (i2.hasNext()) { final Object o2 = i2.next(); if (!(o2 instanceof JSONObject)) return false; if (equals((JSONObject) o1, (JSONObject) o2)) found = true; } else if (o1 instanceof JSONArray) while (i2.hasNext()) { final Object o2 = i2.next(); if (!(o2 instanceof JSONArray)) return false; if (equals((JSONArray) o1, (JSONArray) o2)) found = true; } else while (i2.hasNext()) { final Object o2 = i2.next(); if (o1.equals(o2)) found = true; } if (!found) return false; } return true; }
From source file:MicroMap.java
/** * @see java.util.Map#containsValue(java.lang.Object) *//*from w ww .j a v a2 s . c om*/ public boolean containsValue(final Object value) { return value.equals(this.value); }
From source file:org.atemsource.atem.impl.json.attribute.ChildrenAttribute.java
@Override public boolean isEqual(Object entity, Object other) { return entity.equals(other); }