Tabnine Logo
SparseArray.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.heaven7.java.base.util.SparseArray
constructor

Best Java code snippets using com.heaven7.java.base.util.SparseArray.<init> (Showing top 13 results out of 315)

origin: LightSun/data-mediator

static SparseArray readSparseArray0(Parcel in, ClassLoader loader) {
  int N = in.readInt();
  if (N < 0) {
    return null;
  }
  SparseArray sa = new SparseArray(N);
  readSparseArrayInternal(in, sa, N, loader);
  return sa;
}
static void readSparseArrayInternal(Parcel in, SparseArray outVal, int N,
origin: LightSun/data-mediator

@Override
public SparseArray<T> read(JsonReader in) throws IOException {
  SparseArray<T> map = new SparseArray<>();
  in.beginObject();
  while (in.hasNext()){
    String name = in.nextName();
    map.put(Integer.parseInt(name), mAdapter.read(in));
  }
  in.endObject();
  return map;
}
origin: LightSun/data-mediator

  @Override
  public SparseArray<Car3> read(JsonReader in) throws IOException {
    SparseArray<Car3> map = new SparseArray<>();
    in.beginObject();
    while (in.hasNext()){
      String name = in.nextName();
      map.put(Integer.parseInt(name), mAdapter.read(in));
    }
    in.endObject();
    return map;
  }
}
origin: LightSun/data-mediator

  @Override
  public void read(JsonReader in, GsonProperty property, Object t) throws IOException {
    final Class<?> simpleType = property.getType();
    final SparseArray sa = new SparseArray();
    in.beginObject();
    if (simpleType.isPrimitive() || isBoxedClass(simpleType)) {
      while (in.hasNext()) {
        int key = Integer.parseInt(in.nextName());
        sa.put(key, SupportUtils.readPrimitiveOrItsBox(in, property));
      }
    }else{
      TypeAdapter adapter = getTypeAdapter(simpleType);
      while (in.hasNext()) {
        int key = Integer.parseInt(in.nextName());
        Object val = adapter.read(in);
        if (val != null) {
          sa.put(key, val);
        }
      }
    }
    setValue(property, t, sa);
    in.endObject();
  }
}
origin: LightSun/data-mediator

public TestGsonBean() {
  doubelSparse = new SparseArray<>();
  doubelSparse.put(1, 1.6);
  doubelSparse.put(2, 2.6);
}
origin: LightSun/data-mediator

/**
 * clear all key-values .
 * @return this.
 */
public SparseArrayPropertyEditor<D, V> clear(){
  final int size = mMap.size();
  if(size == 0){
    return this;
  }
  SparseArray<V> newMap = new SparseArray<>(size * 4 /3 + 1);
  mMap.clearTo(DataMediatorDelegate.getDefault().getSparseArrayDelegate(newMap));
  if(mMediator != null){
    mMediator._getSparseArrayDispatcher().dispatchClearEntries(mProperty, newMap);
  }
  return this;
}
origin: LightSun/data-mediator

@Override
public SparseArrayPropertyEditor<IStudent, String> beginCityDataEditor() {
  if(cityData == null){
    cityData = new SparseArray<>();
  }
  return new SparseArrayPropertyEditor<IStudent, String>(this,
      DataMediatorDelegate.getDefault().getSparseArrayDelegate(cityData),
      null, null);
}
origin: LightSun/data-mediator

@Override
public SparseArrayPropertyEditor<IStudent, String> beginCityDataEditor() {
  if(cityData == null){
    cityData = new SparseArray<>();
  }
  return new SparseArrayPropertyEditor<IStudent, String>(this,
      DataMediatorDelegate.getDefault().getSparseArrayDelegate(cityData),
      null, null);
}
origin: LightSun/data-mediator

/**
 * clear all key-values .
 * @return this.
 */
public SparseArrayPropertyEditor<D, V> clear(){
  final int size = mMap.size();
  if(size == 0){
    return this;
  }
  SparseArray<V> newMap = new SparseArray<>(size * 4 /3 + 1);
  mMap.clearTo(DataMediatorDelegate.getDefault().getSparseArrayDelegate(newMap));
  if(mMediator != null){
    mMediator._getSparseArrayDispatcher().dispatchClearEntries(mProperty, newMap);
  }
  return this;
}
origin: LightSun/data-mediator

@Override
public SparseArrayPropertyEditor<IStudent, String> beginCityDataEditor() {
  IStudent target = _getTarget();
  SparseArray<String> cityData = target.getCityData();
  if(cityData == null){
    cityData = new SparseArray<>();
    target.setCityData(cityData);
  }
  return new SparseArrayPropertyEditor<IStudent, String>(this,
      DataMediatorDelegate.getDefault().getSparseArrayDelegate(cityData),
      PROP_cityData, this);
}
origin: LightSun/data-mediator

@Override
public SparseArrayPropertyEditor<IStudent, String> beginCityDataEditor() {
  IStudent target = _getTarget();
  SparseArray<String> cityData = target.getCityData();
  if(cityData == null){
    cityData = new SparseArray<>();
    target.setCityData(cityData);
  }
  return new SparseArrayPropertyEditor<IStudent, String>(this,
      DataMediatorDelegate.getDefault().getSparseArrayDelegate(cityData),
      PROP_cityData, this);
}
origin: LightSun/data-mediator

private static TestGsonBean newTestGsonBean() {
  List<Car3> list = new ArrayList<>();
  SparseArray<Car3> map = new SparseArray<>();
  Car3[] arr = new Car3[3];
  for(int i = 0 ; i < 3 ; i++){
    Car3 car = new Car3();
    car.setMark("AUDI");
    car.setModel(2014); //2,1
    car.setType("DIESEL");
    car.setMaker("AUDI GERMANY");
    car.setCost(i * 100);
    car.getColors().add("GREY");
    car.getColors().add("BLACK");
    car.getColors().add("WHITE");
    list.add(car);
    map.put(i, car);
    arr[i] = car;
  }
  TestGsonBean tl = new TestGsonBean();
  tl.setList(list);
  tl.setCarMap(map); //null时,map不参与序列化输出
  tl.setCarsArr(arr);
  tl.setCar(arr[0]);
  return tl;
}
origin: LightSun/data-mediator

SparseArray<TestGsonBean> sa = new SparseArray<>();
sa.put(1, newTestGsonBean());
sa.put(2, newTestGsonBean());
com.heaven7.java.base.utilSparseArray<init>

Popular methods of SparseArray

  • keyAt
  • put
  • size
  • valueAt
  • get
  • clear
  • getAndRemove
  • indexOfValue
  • removeAt
  • setValueAt
  • append
  • toString
  • append,
  • toString

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now