如何在Java中排序方法后清除缓冲区?(How to clear buffer after sorting method in Java?)
我有方法在Java中排序元素,它工作正常但我需要在排序后清除缓冲区。 看起来旧值保留在缓冲区和复制当前数据及其不良。 谁能知道解决方案?
我的排序方法:
public List<InterimOrders> getInterimOrdersList() { if(interimOrdersList == null){ interimOrdersList = new ArrayList<InterimOrders>(); interimOrdersList.addAll(interimOrdRepo.findByLocation(location)); for(InterimOrders io: interimOrdersList){ if(io.isOnceAMonth()){ List<Object[]> tmpList = new ArrayList<Object[]>(); long[] datyLongTab = new long[3]; Object[] tmpOb = new Object[1]; tmpOb[0] = (Object)io.getDate1(); if(io.getDate1() != null){ datyLongTab[0] = io.getDate1().getTime(); } else{ datyLongTab[0] = 9223372036854775807L; } tmpList.add(tmpOb); tmpOb = new Object[1]; tmpOb[0] = (Object)io.getDate2(); if(io.getDate2() != null){ datyLongTab[1] = io.getDate2().getTime(); } else{ datyLongTab[1] = 9223372036854775807L; } tmpList.add(tmpOb); tmpOb = new Object[1]; tmpOb[0] = (Object)io.getDate3(); if(io.getDate3() != null){ datyLongTab[2] = io.getDate3().getTime(); } else{ datyLongTab[2] = 9223372036854775807L; } tmpList.add(tmpOb); Arrays.sort(datyLongTab); for(int i=0; i<3; i++){ long dat = 9223372036854775807L; for(Object[] ele: tmpList){ if(ele[0] != null){ dat = ((Date)ele[0]).getTime(); } if(dat==datyLongTab[i]){ switch(i){ case 0: io.setDate1((Date)ele[0]); break; case 1: io.setDate2((Date)ele[0]); break; case 2: io.setDate3((Date)ele[0]); break; } break; } } } }return interimOrdersList;
I have method to sorting elements in Java, it works fine but i need to clear buffer after sorting. It looks like old value stay in buffer and repolace current data and its bad. Can anybody know the solution?
My sorting method:
public List<InterimOrders> getInterimOrdersList() { if(interimOrdersList == null){ interimOrdersList = new ArrayList<InterimOrders>(); interimOrdersList.addAll(interimOrdRepo.findByLocation(location)); for(InterimOrders io: interimOrdersList){ if(io.isOnceAMonth()){ List<Object[]> tmpList = new ArrayList<Object[]>(); long[] datyLongTab = new long[3]; Object[] tmpOb = new Object[1]; tmpOb[0] = (Object)io.getDate1(); if(io.getDate1() != null){ datyLongTab[0] = io.getDate1().getTime(); } else{ datyLongTab[0] = 9223372036854775807L; } tmpList.add(tmpOb); tmpOb = new Object[1]; tmpOb[0] = (Object)io.getDate2(); if(io.getDate2() != null){ datyLongTab[1] = io.getDate2().getTime(); } else{ datyLongTab[1] = 9223372036854775807L; } tmpList.add(tmpOb); tmpOb = new Object[1]; tmpOb[0] = (Object)io.getDate3(); if(io.getDate3() != null){ datyLongTab[2] = io.getDate3().getTime(); } else{ datyLongTab[2] = 9223372036854775807L; } tmpList.add(tmpOb); Arrays.sort(datyLongTab); for(int i=0; i<3; i++){ long dat = 9223372036854775807L; for(Object[] ele: tmpList){ if(ele[0] != null){ dat = ((Date)ele[0]).getTime(); } if(dat==datyLongTab[i]){ switch(i){ case 0: io.setDate1((Date)ele[0]); break; case 1: io.setDate2((Date)ele[0]); break; case 2: io.setDate3((Date)ele[0]); break; } break; } } } }return interimOrdersList;
原文:https://stackoverflow.com/questions/19986534
更新时间:2023-06-15 17:06
最满意答案
在初始化幻灯片时,听起来好像没有加载循环插件。 检查firebug中的NET选项卡或Chrome开发人员工具中的资源选项卡。 确保循环链接在幻灯片代码之前。 此外,在初始化循环时确保DOM已准备就绪:
$(function() { $('#slides').cycle({ fx: 'scrollLeft' }); });
要么
$(document).ready(function() { $('#slides').cycle({ fx: 'scrollLeft' }); });
It sounds like the cycle plugin isn't loaded when you're initializing the slideshow. Check the NET tab in firebug or the resources tab in Chrome developer tools. Make sure the link to cycle is before your slideshow code. Also, make sure the DOM is ready when you initialize cycle:
$(function() { $('#slides').cycle({ fx: 'scrollLeft' }); });
or
$(document).ready(function() { $('#slides').cycle({ fx: 'scrollLeft' }); });
相关问答
更多-
listview函数可能是jQuery的插件。 该插件文件是否已及时添加到页面? 该错误可能意味着缺少插件。 The listview function is presumably a plugin for jQuery. Has that plugin file been added to page in time? That error can mean a missing plugin.
-
那是因为alert()属于window对象。 That's because alert() belongs to the window object.
-
看起来你忘了添加tagsinput js脚本..(和obivously jquery.js) 这里在标签中添加它该错误是由于data-href上的错误值造成的。 我有“https”而不是“http”。 The error was due to a bad value on data-href. I had "https" instead of "http".为了调用DOM元素的单击处理程序,IE定义了一个基本上触发click事件的click方法。 Firefox从FF 5+实现了它。 但是Chrome仍然使用标准的W3C定义的dispatchEvent以编程方式触发事件。 或者也可能是返回的navindex12对象可能是DOMTextElement。 尝试提醒navindex12.nodeType 总之,在调用click方法之前,您应该尝试优雅地检查浏览器和元素约束。 To invoke the click handler for a DOM element, ...
未捕获的TypeError:对象#[2022-02-20]
看起来你正在使用vencimento作为字符串和jQuery对象。 你不能这样做。 或许像这样制作一个新的变量vencimentoText : var vencimentoText = vencimento.val(); 然后使用vencimentoText无论你当前在哪里使用它作为字符串(例如,使用replace , substring等,但不是addClass等) It looks like you're using vencimento as both a string and a jQuery o ...相关文章
更多- Map、List集合类的清空使用clear还是重新new呢
- 研磨设计模式之工厂方法模式(Factory Method)-模式讲解2
- 研磨设计模式之工厂方法模式(Factory Method)-场景问题
- Java 方法
- 研磨设计模式之工厂方法模式(Factory Method)-模式讲解1
- 研磨设计模式之工厂方法模式(Factory Method)-模式讲解3
- 研磨设计模式之工厂方法模式(Factory Method)-解决方案
- java是什么
- Java 反射问题
- Java 异常处理
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。