@Test @SuppressWarnings("rawtypes") public void existsWorks() { DatabaseReference ref = UnitTestHelpers.getRandomNode(); DataSnapshot snap; snap = snapFor(new HashMap(), ref); assertFalse(snap.exists()); snap = snapFor(new MapBuilder().put(".priority", 1).build(), ref); assertFalse(snap.exists()); snap = snapFor(null, ref); assertFalse(snap.exists()); snap = snapFor(true, ref); assertTrue(snap.exists()); snap = snapFor(5, ref); assertTrue(snap.exists()); snap = snapFor(new MapBuilder().put("x", 5).build(), ref); assertTrue(snap.exists()); }
public boolean exists() { return !node.getNode().isEmpty(); }
DataSnapshot { public boolean exists() { return !node.getNode().isEmpty(); } }
DataSnapshot { public boolean exists() { return !node.getNode().isEmpty(); } DataSnapshot(DatabaseReference ref, IndexedNode node); }
DataSnapshot { public boolean exists() { return !node.getNode().isEmpty(); } DataSnapshot(DatabaseReference ref, IndexedNode node); @NonNull DataSnapshot child(@NonNull String path); boolean hasChild(@NonNull String path); boolean hasChildren(); boolean exists(); @Nullable Object getValue(); @Nullable Object getValue(boolean useExportFormat); @Nullable T getValue(@NonNull Class<T> valueType); @Nullable T getValue(@NonNull GenericTypeIndicator<T> t); long getChildrenCount(); @NonNull DatabaseReference getRef(); @Nullable String getKey(); @NonNull Iterable<DataSnapshot> getChildren(); @Nullable Object getPriority(); @Override String toString(); }
DataSnapshot { public boolean exists() { return !node.getNode().isEmpty(); } DataSnapshot(DatabaseReference ref, IndexedNode node); @NonNull DataSnapshot child(@NonNull String path); boolean hasChild(@NonNull String path); boolean hasChildren(); boolean exists(); @Nullable Object getValue(); @Nullable Object getValue(boolean useExportFormat); @Nullable T getValue(@NonNull Class<T> valueType); @Nullable T getValue(@NonNull GenericTypeIndicator<T> t); long getChildrenCount(); @NonNull DatabaseReference getRef(); @Nullable String getKey(); @NonNull Iterable<DataSnapshot> getChildren(); @Nullable Object getPriority(); @Override String toString();  }