我正在尝试将数据添加到我的hashmap中,如果地图中尚不存在该键.出于某种原因,即使密钥确实存在,哈希映射也会添加它.我不知道为什么会这样.我的addEntity方法就是问题所在.我试图检测键已经在hashmap中,如果是,则什么都不做.但是,无论密钥是否已存在,它都会出于某种原因始终添加密钥.
我的数据文件:
package timeTraveler.mechanics;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import net.minecraft.entity.EntityLiving;
public class PathingData
{
/**
* Entity data array
*/
public static Map<String[], List<int[]>> allEntityData;
public PathingData()
{
allEntityData = new HashMap<String[], List<int[]>>();
}
/**
* Adds an entity UUID (Unique ID)and MobType to the entity data ArrayList. If the entity already exists inside of the ArrayList, then it skips it.
* @param uuid
*/
public void addEntity(String[] entityData)
{ …Run Code Online (Sandbox Code Playgroud) 当我生成、编译和运行 Visual Studio 项目时,命令提示符也会随窗口一起打开。它使用编译后的 .exe 以及开发环境中执行此操作。有没有办法阻止命令提示符打开已编译的 .exe?