List of usage examples for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS
String CLOSE_PARENTHESIS
To view the source code for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS.
Click Source Link
From source file:com.gleo.plugins.hexiagon.service.persistence.impl.TypePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Type> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w. jav a 2s. c om Map<Serializable, Type> map = new HashMap<Serializable, Type>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Type type = fetchByPrimaryKey(primaryKey); if (type != null) { map.put(primaryKey, type); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(TypeModelImpl.ENTITY_CACHE_ENABLED, TypeImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Type) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_TYPE_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(String.valueOf(primaryKey)); query.append(StringPool.COMMA); } query.setIndex(query.index() - 1); query.append(StringPool.CLOSE_PARENTHESIS); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); for (Type type : (List<Type>) q.list()) { map.put(type.getPrimaryKeyObj(), type); cacheResult(type); uncachedPrimaryKeys.remove(type.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(TypeModelImpl.ENTITY_CACHE_ENABLED, TypeImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.hedu.groovy.scripts.portlet.service.persistence.impl.GroovyScriptPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, GroovyScript> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j av a 2s .c o m*/ Map<Serializable, GroovyScript> map = new HashMap<Serializable, GroovyScript>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); GroovyScript groovyScript = fetchByPrimaryKey(primaryKey); if (groovyScript != null) { map.put(primaryKey, groovyScript); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(GroovyScriptModelImpl.ENTITY_CACHE_ENABLED, GroovyScriptImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (GroovyScript) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_GROOVYSCRIPT_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(String.valueOf(primaryKey)); query.append(StringPool.COMMA); } query.setIndex(query.index() - 1); query.append(StringPool.CLOSE_PARENTHESIS); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); for (GroovyScript groovyScript : (List<GroovyScript>) q.list()) { map.put(groovyScript.getPrimaryKeyObj(), groovyScript); cacheResult(groovyScript); uncachedPrimaryKeys.remove(groovyScript.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(GroovyScriptModelImpl.ENTITY_CACHE_ENABLED, GroovyScriptImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.hitss.layer.service.persistence.PostulacionPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the postulacions where solicitudRequerimientoId = any ?. * * <p>/* w w w . j av a 2 s.c o m*/ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.hitss.layer.model.impl.PostulacionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param solicitudRequerimientoIds the solicitud requerimiento IDs * @param start the lower bound of the range of postulacions * @param end the upper bound of the range of postulacions (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching postulacions * @throws SystemException if a system exception occurred */ @Override public List<Postulacion> findByS(long[] solicitudRequerimientoIds, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((solicitudRequerimientoIds != null) && (solicitudRequerimientoIds.length == 1)) { return findByS(solicitudRequerimientoIds[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { StringUtil.merge(solicitudRequerimientoIds) }; } else { finderArgs = new Object[] { StringUtil.merge(solicitudRequerimientoIds), start, end, orderByComparator }; } List<Postulacion> list = (List<Postulacion>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_S, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Postulacion postulacion : list) { if (!ArrayUtil.contains(solicitudRequerimientoIds, postulacion.getSolicitudRequerimientoId())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_POSTULACION_WHERE); boolean conjunctionable = false; if ((solicitudRequerimientoIds == null) || (solicitudRequerimientoIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < solicitudRequerimientoIds.length; i++) { query.append(_FINDER_COLUMN_S_SOLICITUDREQUERIMIENTOID_5); if ((i + 1) < solicitudRequerimientoIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append("postulacion.activo=true"); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(PostulacionModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (solicitudRequerimientoIds != null) { qPos.add(solicitudRequerimientoIds); } if (!pagination) { list = (List<Postulacion>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Postulacion>(list); } else { list = (List<Postulacion>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_S, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_S, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:com.hitss.layer.service.persistence.PostulacionPersistenceImpl.java
License:Open Source License
/** * Returns the number of postulacions where solicitudRequerimientoId = any ?. * * @param solicitudRequerimientoIds the solicitud requerimiento IDs * @return the number of matching postulacions * @throws SystemException if a system exception occurred *///ww w. j a v a 2s .co m @Override public int countByS(long[] solicitudRequerimientoIds) throws SystemException { Object[] finderArgs = new Object[] { StringUtil.merge(solicitudRequerimientoIds) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_S, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_POSTULACION_WHERE); boolean conjunctionable = false; if ((solicitudRequerimientoIds == null) || (solicitudRequerimientoIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < solicitudRequerimientoIds.length; i++) { query.append(_FINDER_COLUMN_S_SOLICITUDREQUERIMIENTOID_5); if ((i + 1) < solicitudRequerimientoIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append("postulacion.activo=true"); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (solicitudRequerimientoIds != null) { qPos.add(solicitudRequerimientoIds); } count = (Long) q.uniqueResult(); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_S, finderArgs, count); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_S, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:com.hitss.layer.service.persistence.UsuarioPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the usuarios where userId = any ?. * * <p>/* w w w .j a va 2 s.com*/ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.hitss.layer.model.impl.UsuarioModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param userIds the user IDs * @param start the lower bound of the range of usuarios * @param end the upper bound of the range of usuarios (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching usuarios * @throws SystemException if a system exception occurred */ @Override public List<Usuario> findByUsuariosSeleccionados(long[] userIds, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((userIds != null) && (userIds.length == 1)) { return findByUsuariosSeleccionados(userIds[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { StringUtil.merge(userIds) }; } else { finderArgs = new Object[] { StringUtil.merge(userIds), start, end, orderByComparator }; } List<Usuario> list = (List<Usuario>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_USUARIOSSELECCIONADOS, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Usuario usuario : list) { if (!ArrayUtil.contains(userIds, usuario.getUserId())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_USUARIO_WHERE); boolean conjunctionable = false; if ((userIds == null) || (userIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < userIds.length; i++) { query.append(_FINDER_COLUMN_USUARIOSSELECCIONADOS_USERID_5); if ((i + 1) < userIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append("usuario.activo=true"); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(UsuarioModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (userIds != null) { qPos.add(userIds); } if (!pagination) { list = (List<Usuario>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Usuario>(list); } else { list = (List<Usuario>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_USUARIOSSELECCIONADOS, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_USUARIOSSELECCIONADOS, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:com.hitss.layer.service.persistence.UsuarioPersistenceImpl.java
License:Open Source License
/** * Returns the number of usuarios where userId = any ?. * * @param userIds the user IDs//ww w. j a v a 2 s . co m * @return the number of matching usuarios * @throws SystemException if a system exception occurred */ @Override public int countByUsuariosSeleccionados(long[] userIds) throws SystemException { Object[] finderArgs = new Object[] { StringUtil.merge(userIds) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_USUARIOSSELECCIONADOS, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_USUARIO_WHERE); boolean conjunctionable = false; if ((userIds == null) || (userIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < userIds.length; i++) { query.append(_FINDER_COLUMN_USUARIOSSELECCIONADOS_USERID_5); if ((i + 1) < userIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append("usuario.activo=true"); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (userIds != null) { qPos.add(userIds); } count = (Long) q.uniqueResult(); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_USUARIOSSELECCIONADOS, finderArgs, count); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_USUARIOSSELECCIONADOS, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:com.ihg.me2.service.persistence.EmailReminderPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the email reminders where statusCode = any ?. * * <p>//from w ww . j a va 2 s .c o m * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.ihg.me2.model.impl.EmailReminderModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param statusCodes the status codes * @param start the lower bound of the range of email reminders * @param end the upper bound of the range of email reminders (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching email reminders * @throws SystemException if a system exception occurred */ @Override public List<EmailReminder> findByStatus(String[] statusCodes, int start, int end, OrderByComparator orderByComparator) throws SystemException { if ((statusCodes != null) && (statusCodes.length == 1)) { return findByStatus(statusCodes[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { StringUtil.merge(statusCodes) }; } else { finderArgs = new Object[] { StringUtil.merge(statusCodes), start, end, orderByComparator }; } List<EmailReminder> list = (List<EmailReminder>) FinderCacheUtil .getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_STATUS, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (EmailReminder emailReminder : list) { if (!ArrayUtil.contains(statusCodes, emailReminder.getStatusCode())) { list = null; break; } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_EMAILREMINDER_WHERE); boolean conjunctionable = false; if ((statusCodes == null) || (statusCodes.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < statusCodes.length; i++) { String statusCode = statusCodes[i]; if (statusCode == null) { query.append(_FINDER_COLUMN_STATUS_STATUSCODE_4); } else if (statusCode.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_STATUS_STATUSCODE_6); } else { query.append(_FINDER_COLUMN_STATUS_STATUSCODE_5); } if ((i + 1) < statusCodes.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(EmailReminderModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (statusCodes != null) { qPos.add(statusCodes); } if (!pagination) { list = (List<EmailReminder>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<EmailReminder>(list); } else { list = (List<EmailReminder>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_STATUS, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_STATUS, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:com.ihg.me2.service.persistence.EmailReminderPersistenceImpl.java
License:Open Source License
/** * Returns the number of email reminders where statusCode = any ?. * * @param statusCodes the status codes// w w w .j a v a 2 s . c om * @return the number of matching email reminders * @throws SystemException if a system exception occurred */ @Override public int countByStatus(String[] statusCodes) throws SystemException { Object[] finderArgs = new Object[] { StringUtil.merge(statusCodes) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_STATUS, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_EMAILREMINDER_WHERE); boolean conjunctionable = false; if ((statusCodes == null) || (statusCodes.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < statusCodes.length; i++) { String statusCode = statusCodes[i]; if (statusCode == null) { query.append(_FINDER_COLUMN_STATUS_STATUSCODE_4); } else if (statusCode.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_STATUS_STATUSCODE_6); } else { query.append(_FINDER_COLUMN_STATUS_STATUSCODE_5); } if ((i + 1) < statusCodes.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (statusCodes != null) { qPos.add(statusCodes); } count = (Long) q.uniqueResult(); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_STATUS, finderArgs, count); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_STATUS, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:com.inikah.slayer.model.impl.ProfileImpl.java
License:Open Source License
public String getTitle() { StringBuilder sb = new StringBuilder(); sb.append(getProfileName());/*from w w w. j av a2s . c om*/ sb.append(StringPool.SPACE); sb.append(StringPool.OPEN_PARENTHESIS); sb.append(getProfileCode()); sb.append(StringPool.CLOSE_PARENTHESIS); return sb.toString(); }
From source file:com.inikah.slayer.model.impl.ProfileImpl.java
License:Open Source License
public List<KeyValuePair> getLanguagesSpokenForFilter() { List<KeyValuePair> results = new ArrayList<KeyValuePair>(); List<KeyValuePair> original = getLanguagesSpokenAsList(); List<KeyValuePair> actuals = FilterUtil.getLanguagesSpoken(isBride()); for (KeyValuePair kvPair1 : actuals) { String key1 = kvPair1.getKey(); for (KeyValuePair kvPair2 : original) { String key2 = kvPair2.getKey(); if (key2.equalsIgnoreCase(key1)) { StringBuilder sb = new StringBuilder(); sb.append(kvPair2.getValue()); sb.append(StringPool.SPACE); sb.append(StringPool.OPEN_PARENTHESIS); sb.append(kvPair1.getValue()); sb.append(StringPool.CLOSE_PARENTHESIS); results.add(new KeyValuePair(key1, sb.toString())); break; }//from w w w. j a va 2 s . c o m } } return ListUtil.sort(results, new KeyValuePairComparator(false, true)); }