HyCodeYourTale
classpublicPriority 3

Indexer

com.hypixel.hytale.builtin.hytalegenerator.Indexer

2

Methods

2

Public Methods

0

Fields

1

Constructors

Constructors

public
Indexer()

Methods

Public Methods (2)

public
int getIdFor(Object o)
public
int size()

Source Code

package com.hypixel.hytale.builtin.hytalegenerator;

import java.util.HashMap;
import java.util.Map;

public class Indexer {
   private Map<Object, Integer> ids = new HashMap<>();

   public Indexer() {
   }

   public int getIdFor(Object o) {
      return this.ids.computeIfAbsent(o, k -> this.ids.size());
   }

   public int size() {
      return this.ids.size();
   }
}