jdk源码:
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
public boolean isEmpty() {
return size == 0;
}
应用场景:
public <T> T find(Class<T> $class, Date statTime, String businessType) {
Session session = sessionFactory.getCurrentSession();
Map<String, Object> properties = new HashMap<String, Object>();
StringBuffer hql = new StringBuffer("from " + $class.getSimpleName() + " t where t.businessType = :businessType and t.statTime = :statTime ");
properties.put("statTime", statTime);
properties.put("businessType", businessType);
Query query = session.createQuery(hql.toString());
query.setProperties(properties);
List<T> list = query.list();
if (list.isEmpty()) {// 为空 代表这条数据不存在
return null;
} else {
return list.get(0);
}
}
分享到:
相关推荐
if (list.isEmpty())//若列表为空,则 nextPosition = null;//当前元素置空 else//否则 nextPosition = list.first();//从第一个元素开始 } //检查迭代器中是否还有剩余的元素 public boolean hasNext...
这是之前分页的升级版 带国际化 表单验证 用户登录 安全退出 功能都实现了就是不太美观 开发环境 myeclipse6.0 jdk1.6 Tomcat6.0 sql2000 数据库也放到里面了 在db文件夹下 库文件不变 ... return list.isEmpty(); }
private def headOf(list:List[T]) = if (list.isEmpty) func.zero else list.head private def tailOf(list:List[T]) = if (list.isEmpty) Nil else list.tail def isZero = cell == func.zero def execute(ch:...
if(list.isEmpty()) return false; HibernateUtil.executeUpdate( "delete from PasswordTicket as pt where pt.user=?", new Object[] { user } ); HibernateUtil.executeUpdate( ...
允许的库函数: List.head , List.tail , List.isEmpty 问题1 编写一个递归函数prod: (lst:int list) -> int ,该函数返回整数列表中元素的乘积。 问题2 编写一个递归函数map: (f:(int -> 'a) -> int list -> '...
bool IsEmpty() const { return length == 0; }//判断线性表是否为空 int Length() const { return length; }//返回数组长度 void SetLength(int SetLength) { length = SetLength; }//设置数组长度 int MaxSize...
二叉树层序遍历Ⅰ——剑指offer32-Ⅰ ...q.isEmpty()) { TreeNode node = q.poll(); list.add(node.val); if (node.left != null) q.add(node.left); if (node.right != null) q.add(node.right); }
适合新手使用 代码片段: public class MainActivity extends Activity implements... if (TextUtils.isEmpty(newText)) { list.clearTextFilter(); } else { list.setFilterText(newText); } return true; } }
1,编写程序,判断给定的某个年份是否是闰年。 闰年的判断规则如下: (1)若某个年份能被4整除但不能被100整除,则是闰年。 (2)若某个年份能被400整除,则也是闰年。 import java.util.Scanner;...
if(StringUtils.isEmpty(serverurl)){ return "请求列表为null"; } System.out.println("请求服务地址:"+serverurl); return restTemplate.getForObject(serverurl,String.class); } private ...
int list_isempty(struct list *list); void list_clear(struct list *list); int list_count(struct list *list); int list_get(struct list *list, int index); int list_remove(struct list *list, int index); ...
第二种类型是序列(sequence),也就是若干个相关的数据按照一定顺序并列在一起,又叫做数组(array)或列表(List),比如”北京,上海”。 第三种类型是映射(mapping),也就是一个名/值对(Name/value),即...
List<User> users = userRepository.findAll(); modelMap.put("users", users); return "jpatest"; } /** * 输出字符串测试 * http://localhost:8080/helloboot * @return */ @RequestMapping("/...
public Builder setContent(List<String> contents) { dialog.mContents = contents; return this; } /** * 单条提示 */ public Builder setContent(String content) { dialog.mContent = content; ...
if (CollectionUtils.isEmpty(list)) { return categoryTree; } for (CategoryDO categoryDO : list) { allDTOList.add(new CategoryTreeDTO().convertDOToDTO(categoryDO)); } //当前等级类目 category...
List<PageBean> list = new ArrayList(); newgetResouce newgetresouce = new newgetResouce(); //通过显示页面传递一个pagetype对象和PaginationBean对象 Page page = new Page(request.getParameter(...
try {List,Object>> listLog = maintainlogService.selectListByDownload(memberId,date,keyword);//查询数据库中的数据 //excel数据 List<Object> listData = new ArrayList<Object>(); if (null ...
用 Bézier 曲线进行插补,使线条更平滑...signaturePad.isEmpty(); // Unbinds all event handlers signaturePad.off(); // Rebinds all event handlers signaturePad.on(); 标签:Signature
sendText.isEmpty()) { QString windowTitle = this->windowTitle().replace("].",""); QString toId = QString(windowTitle.split("[").at(1)); QString msgType = "MSG_CLIENT_CHAT"; QByteArray block; ...
List list = new List_DLNode(); Iterator P = L.positions(); while (P.hasNext()) { Position pos = (Position)P.getNext(); Entry entry = (EntryDefault) pos.getElem(); if (T.isEqualTo(entry....