我正在创建一个react-native应用程序,我创建的其中一个组件包含一个属性,该属性通过来自http请求的数据填充.
现在我正在从我的笔记本电脑托管服务器,但是我正在使用Expo应用程序在手机上测试应用程序.由于这些是两个独立的设备,http:// localhost:3000调用不起作用,因此我无法判断我的组件是否正常工作.
有没有办法在我的笔记本电脑上运行服务器并进行设置,以便来自Expo应用程序的http请求到达服务器?
所以我有一个键值对的HashMap,并希望创建一个使用每个键值对实例化的新对象列表.例如:
//HashMap of coordinates with the key being x and value being y
Map<Integer, Integer> coordinates = new HashMap<Integer, Integer>();
coordinates.put(1,2);
coordinates.put(3,4);
List<Point> points = new ArrayList<Point>();
//Add points to the list of points instantiated using key-value pairs in HashMap
for(Integer i : coordinates.keySet()){
points.add(new Point(i , coordinates.get(i)));
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使用Java 8流做同样的事情.