Java 8 AbstractMap.SimpleEntry - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AbstractMap.SimpleEntry class.

This code example shows how to use the following methods:toString, getKey, getValue
                ^ (e.getValue() == null ? 0 : e.getValue().hashCode()), e
                .hashCode());
    } 
     
    public void test_SimpleEntry_toString() throws Exception { 
        Entry e = new AbstractMap.SimpleEntry<Integer, String>(1, "test");
        assertEquals(e.getKey()+"="+e.getValue(),e.toString());
    } 
     
    /** 
     * @tests serialization/deserialization. 
     */ 
    @SuppressWarnings({ "unchecked", "boxing" }) 
    public void testSerializationSelf_SimpleEntry() throws Exception { 
        Entry e = new AbstractMap.SimpleEntry<Integer, String>(1, "test");
        SerializationTest.verifySelf(e);
    } 
 
    /** 
     * @tests serialization/deserialization compatibility with RI. 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
        //test insert 
        tree.put(11, "aa11");
        tree.put(12, "aa12");
        assertTrue(ins.contains(new SimpleEntry(11, "aa11")));
        assertTrue(ins.contains(new SimpleEntry(12, "aa12")));
        assertTrue(ins.size() == 2);
        ins.clear();
        assertTrue(dels.isEmpty());
        assertTrue(updNew.isEmpty());
        assertTrue(updOld.isEmpty());
 
        //test update 
        tree.put(12, "aa123");
        assertTrue(ins.isEmpty());
        assertTrue(dels.isEmpty());
        assertTrue(updOld.contains(new SimpleEntry(12, "aa12")));
        assertTrue(updOld.size() == 1);
        updOld.clear();
        assertTrue(updNew.contains(new SimpleEntry(12, "aa123")));
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getKey, getValue
		activeViolationTypesRepository.setActiveViolationTypes(activeViolationTypes);
	} 
 
	public void createHistoryPoint(String description) {
		SimpleEntry<Calendar, List<Violation>> violationsResult = getAllViolations();
		Calendar date = violationsResult.getKey();
		List<Violation> violations = violationsResult.getValue();
 
		ViolationHistory violationHistory = new ViolationHistory(violations, getAllSeverities(), date, description);
		violationHistoryRepository.addViolationHistory(violationHistory);
	} 
 
	public void removeViolationHistory(Calendar date) {
		violationHistoryRepository.removeViolationHistory(date);
	} 
 
	public ViolationHistory getViolationHistoryByDate(Calendar date) {
		return violationHistoryRepository.getViolationHistoryByDate(date);
	} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	@Override 
	public void createReport(File file, String fileType, Calendar date) {
		try { 
			if (file.createNewFile()) {
				ViolationHistory violationHistory = taskServiceImpl.getViolationHistoryByDate(date);
				reportFactory.exportReport(fileType, new SimpleEntry<Calendar, List<Violation>>(violationHistory.getDate(), violationHistory.getViolations()), file.getName(), file.getParent(), violationHistory.getSeverities());
				return; 
			} 
		} catch (IOException e) {
			throw new FileNotAccessibleException(file);
		} 
		throw new FileNotAccessibleException(file);
 
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getValue
 
public class ExportViolations { 
	public Element getAllViolations(SimpleEntry<Calendar, List<Violation>> allViolations) {
		Element root = new Element("violations"); 
		 
		for(int i = 0; i < allViolations.getValue().size(); i++) {
			System.out.println(allViolations.getValue().get(i).toString());
		}	 
		return root; 
	} 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	void addViolation(Violation violation) {
		this.violations.add(violation);
	} 
 
	SimpleEntry<Calendar, List<Violation>> getAllViolations() {
		return new SimpleEntry<Calendar, List<Violation>>(getCurrentCalendar(), violations);
	} 
	 
	Calendar getCurrentCalendar() {
		return Calendar.getInstance();
	} 
 
	void clear() { 
		this.violations = new ArrayList<Violation>();
	} 
 
	Calendar getRepositoryCalendar() {
		return repositoryCalendar;
	} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        if (extractor == null) 
            throw new IllegalArgumentException( 
                    "boolean extractor cannot be null"); 
 
        conditionalTextColorEntry = new SimpleEntry<BooleanExtractor<T>, Integer[]>( 
                extractor, new Integer[]{colorIfTrue, colorIfFalse}); 
 
        return this; 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     
    @Override 
    public Entry<Integer, V> next() { 
        byte[] bytes = _store.get(_index); 
        V value = (bytes == null) ? null : _serializer.deserialize(bytes); 
        Entry<Integer, V> ret = new SimpleEntry<Integer, V>(_index, value); 
        _index++; 
        return ret; 
    } 
     
    @Override 
    public void remove() { 
        throw new UnsupportedOperationException(); 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	@Override 
	public void createReport(File file, String fileType, Calendar date) {
		try { 
			if (file.createNewFile()) {
				ViolationHistory violationHistory = taskServiceImpl.getViolationHistoryByDate(date);
				reportFactory.exportReport(fileType, new SimpleEntry<Calendar, List<Violation>>(violationHistory.getDate(), violationHistory.getViolations()), file.getName(), file.getParent(), violationHistory.getSeverities());
				return; 
			} 
		} catch (IOException e) {
			throw new FileNotAccessibleException(file);
		} 
		throw new FileNotAccessibleException(file);
 
	} 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        return _store.hasIndex(_index); 
    } 
     
    @Override 
    public Entry<Integer, byte[]> next() { 
        Entry<Integer, byte[]> ret = new SimpleEntry<Integer, byte[]>(_index, _store.get(_index)); 
        _index++; 
        return ret; 
    } 
     
    @Override 
    public void remove() { 
        throw new UnsupportedOperationException(); 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 AbstractMap.SimpleEntry Methods: