小编iSe*_*Jay的帖子

从Expo App调用本地托管服务器

我正在创建一个react-native应用程序,我创建的其中一个组件包含一个属性,该属性通过来自http请求的数据填充.

现在我正在从我的笔记本电脑托管服务器,但是我正在使用Expo应用程序在手机上测试应用程序.由于这些是两个独立的设备,http:// localhost:3000调用不起作用,因此我无法判断我的组件是否正常工作.

有没有办法在我的笔记本电脑上运行服务器并进行设置,以便来自Expo应用程序的http请求到达服务器?

react-native axios expo

13
推荐指数
6
解决办法
8124
查看次数

Java 8 Stream:使用HashMap中的值填充实例化的对象列表

所以我有一个键值对的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流做同样的事情.

java java-8 java-stream

2
推荐指数
1
解决办法
5104
查看次数

标签 统计

axios ×1

expo ×1

java ×1

java-8 ×1

java-stream ×1

react-native ×1