Android Open Source - itude-mobile-android-util Converted List






From Project

Back to project page itude-mobile-android-util.

License

The source code is released under:

Apache License

If you think the Android project itude-mobile-android-util listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.itude.mobile.android.util;
/*from w w w.java2s  . com*/
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Utility class to handle converting lists.
 * 
 * @param <From> {@link List} from 
 * @param <To> {@link List} to
 */
public class ConvertedList<From, To> extends AbstractList<To>
{
  public static interface Converter<From, To>
  {
    public To convert(From from);
  }

  private final List<From>          _backing;
  private final Converter<From, To> _converter;

  /**
   *  Constructor for ConvertedList.
   * 
   * @param backing {@link Collection} from
   * @param converter {@link Converter}
   */
  public ConvertedList(Collection<From> backing, Converter<From, To> converter)
  {
    _backing = backing instanceof List ? (List<From>) backing : new ArrayList<From>(backing);
    _converter = converter;
  }

  /**
   * @see java.util.AbstractList#get(int)
   */
  @Override
  public To get(int location)
  {
    return _converter.convert(_backing.get(location));
  }

  /**
   * @see java.util.AbstractCollection#size()
   */
  @Override
  public int size()
  {
    return _backing.size();
  }
}




Java Source Code List

com.itude.mobile.android.util.AssertUtil.java
com.itude.mobile.android.util.AssetUtil.java
com.itude.mobile.android.util.ByteUtil.java
com.itude.mobile.android.util.CollectionUtilities.java
com.itude.mobile.android.util.ComparisonUtil.java
com.itude.mobile.android.util.ConvertedList.java
com.itude.mobile.android.util.DataUtil.java
com.itude.mobile.android.util.DateUtil.java
com.itude.mobile.android.util.DeviceUtil.java
com.itude.mobile.android.util.DoubleUtil.java
com.itude.mobile.android.util.FileUtil.java
com.itude.mobile.android.util.ItudeException.java
com.itude.mobile.android.util.MathUtil.java
com.itude.mobile.android.util.RunnableWithParam.java
com.itude.mobile.android.util.ScreenUtil.java
com.itude.mobile.android.util.StringUtil.java
com.itude.mobile.android.util.TwinResult.java
com.itude.mobile.android.util.UIUtil.java
com.itude.mobile.android.util.UniqueIntegerGenerator.java
com.itude.mobile.android.util.ValidationUtil.java
com.itude.mobile.android.util.ViewUtilities.java
com.itude.mobile.android.util.exceptions.DataParsingException.java
com.itude.mobile.android.util.exceptions.DateParsingException.java
com.itude.mobile.android.util.https.EasySSLSocketFactory.java
com.itude.mobile.android.util.https.EasyX509TrustManager.java
com.itude.mobile.android.util.log.MBLog.java