From: Doni Pracner Date: Fri, 25 May 2018 21:16:10 +0000 (+0200) Subject: StekIFajlovi, dodatne provere za fajl i stek X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=b7fc5b1715927eb02b41892ca3f43708a09fc179;p=spa1-materijali.git StekIFajlovi, dodatne provere za fajl i stek --- diff --git a/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java b/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java index 5685b7a..9f12b74 100644 --- a/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java +++ b/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java @@ -18,12 +18,13 @@ public class StekIFajlovi { public static Stek ucitajStek(String imef) { Stek rez = new Stek(); - while (!Svetovid.in(imef).isEmpty()) { + if (Svetovid.testIn(imef)) { + while (!Svetovid.in(imef).isEmpty() && !rez.jePun()) { int broj = Svetovid.in(imef).readInt(); rez.stavi(broj); + } + Svetovid.in(imef).close(); } - Svetovid.in(imef).close(); - return rez; }