MCPcopy Create free account
hub / github.com/defold/defold / readTips

Method readTips

editor/src/java/com/defold/editor/Splash.java:56–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54 }
55
56 private static List<String> readTips() throws IOException {
57 InputStream tipsResource = Thread.currentThread()
58 .getContextClassLoader()
59 .getResourceAsStream("tips.txt");
60 List<String> tips = new ArrayList<>();
61 InputStreamReader reader = new InputStreamReader(tipsResource, Charset.forName("UTF-8"));
62 try (BufferedReader bufferedReader = new BufferedReader(reader)) {
63 String line;
64 while ((line = bufferedReader.readLine()) != null) {
65 if (line.startsWith("#") || line.isEmpty())
66 continue;
67 tips.add(line);
68 }
69 }
70 return tips;
71 }
72
73 private static String randomElement(List<String> tips) {
74 return tips.get(randomInt(tips.size()));

Callers 1

showMethod · 0.95

Calls 3

addMethod · 0.65
readLineMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected